public function testSubmitBuildsExpectedHtmlWithCustomLabel() { Form::clear(); $actual = (string) Form::submit('test')->label('Search'); $expected = '<button type="submit" name="test" id="test">Search</button>'; $this->assertEquals($expected, $actual); }
public function testRadioConditionalSetJunkArgs() { Form::clear(); $actual = (string) Form::radio('pets')->value('Cat')->conditionalChecked('foo'); $expected = '<input type="radio" name="pets" id="pets" value="Cat" />'; $this->assertEquals($expected, $actual); Form::clear(); $actual = (string) Form::radio('pets')->value('Cat')->conditionalChecked(); $expected = '<input type="radio" name="pets" id="pets" value="Cat" />'; $this->assertEquals($expected, $actual); }
public function testSelectCountyBuildsExpectedHtmlWithLabel() { Form::clear(); $actual = (string) Form::selectCounty('county')->forState('AR')->label('Choose County'); $this->assertContains('<option value="">Choose County</option>', $actual); $this->assertContains('<option value="Pulaski">Pulaski</option>', $actual); }
public function testGetSelectedReturnsExpectedHtmlArray() { Form::clear(); Form::setData(['fruits' => ['apples', 'oranges']]); $actual = Form::getSelected('fruits', 'apples'); $expected = 'selected = "selected"'; $this->assertEquals($expected, $actual); $actual = Form::getSelected('fruits', 'oranges'); $expected = 'selected = "selected"'; $this->assertEquals($expected, $actual); $actual = Form::getSelected('fruits', 'pears'); $expected = null; $this->assertEquals($expected, $actual, 'Pears should not be selected.'); }
public function testTextAreaBuildsExpectedHtmlFromSetData() { Form::clear(); Form::setData(['test' => 'Foo']); $actual = (string) Form::textarea('test'); $expected = '<textarea name="test" id="test">Foo</textarea>'; $this->assertEquals($expected, $actual); }