Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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.');
 }
Ejemplo n.º 5
0
 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);
 }