Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b7c357e78 | ||
|
|
7ea28eea5e | ||
|
|
3ff2b89ea4 | ||
|
|
7c02a4f0fd | ||
|
|
3617dac0c4 | ||
|
|
de73798e3e | ||
|
|
59f124084c | ||
|
|
0f4473f9a0 | ||
|
|
af7663294a | ||
|
|
fb7693cf4b | ||
|
|
9c4fea1f04 | ||
|
|
f6d0f1c5c4 | ||
|
|
ebe5123467 |
No files matched your search
+1101
-1015
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -96,7 +96,7 @@ class HtmlBuilder {
|
||||
|
||||
return '<img src="'.$this->url->asset($url, $secure).'"'.$this->attributes($attributes).'>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a link to a Favicon file.
|
||||
*
|
||||
@@ -313,7 +313,7 @@ class HtmlBuilder {
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param string $type
|
||||
* @param string $value
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function listingElement($key, $type, $value)
|
||||
@@ -333,7 +333,7 @@ class HtmlBuilder {
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param string $type
|
||||
* @param string $value
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
protected function nestedListing($key, $type, $value)
|
||||
|
||||
@@ -7,6 +7,7 @@ use Collective\Html\FormBuilder;
|
||||
use Collective\Html\HtmlBuilder;
|
||||
use Illuminate\Routing\UrlGenerator;
|
||||
use Illuminate\Routing\RouteCollection;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class FormBuilderTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
@@ -314,6 +315,24 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals($select, '<select name="size[key]"><option value="L">Large</option><option value="M">Medium</option><option value="S" selected="selected">Small</option></select>');
|
||||
}
|
||||
|
||||
public function testFormWithOptionalPlaceholder()
|
||||
{
|
||||
$select = $this->formBuilder->select(
|
||||
'size',
|
||||
['L' => 'Large', 'S' => 'Small'],
|
||||
null,
|
||||
['placeholder' => 'Select One...']
|
||||
);
|
||||
$this->assertEquals($select, '<select name="size"><option selected="selected" value="">Select One...</option><option value="L">Large</option><option value="S">Small</option></select>');
|
||||
|
||||
$select = $this->formBuilder->select(
|
||||
'size',
|
||||
['L' => 'Large', 'S' => 'Small'],
|
||||
'L',
|
||||
['placeholder' => 'Select One...']
|
||||
);
|
||||
$this->assertEquals($select, '<select name="size"><option value="">Select One...</option><option value="L" selected="selected">Large</option><option value="S">Small</option></select>');
|
||||
}
|
||||
|
||||
public function testFormSelectYear()
|
||||
{
|
||||
@@ -391,6 +410,30 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
|
||||
public function testFormCheckboxWithModelRelation()
|
||||
{
|
||||
$this->formBuilder->setSessionStore($session = m::mock('Illuminate\Session\Store'));
|
||||
$session->shouldReceive('getOldInput')->withNoArgs()->andReturn(array());
|
||||
$session->shouldReceive('getOldInput')->with('items')->andReturn(null);
|
||||
|
||||
$mockModel2 = new StdClass;
|
||||
$mockModel2->id = 2;
|
||||
$mockModel3 = new StdClass;
|
||||
$mockModel3->id = 3;
|
||||
$this->setModel(array('items' => new Collection(array($mockModel2, $mockModel3))));
|
||||
|
||||
$check1 = $this->formBuilder->checkbox('items[]', 1);
|
||||
$check2 = $this->formBuilder->checkbox('items[]', 2);
|
||||
$check3 = $this->formBuilder->checkbox('items[]', 3, false);
|
||||
$check4 = $this->formBuilder->checkbox('items[]', 4, true);
|
||||
|
||||
$this->assertEquals('<input name="items[]" type="checkbox" value="1">', $check1);
|
||||
$this->assertEquals('<input checked="checked" name="items[]" type="checkbox" value="2">', $check2);
|
||||
$this->assertEquals('<input name="items[]" type="checkbox" value="3">', $check3);
|
||||
$this->assertEquals('<input checked="checked" name="items[]" type="checkbox" value="4">', $check4);
|
||||
}
|
||||
|
||||
|
||||
public function testFormCheckboxWithoutSession()
|
||||
{
|
||||
$form1 = $this->formBuilder->checkbox('foo');
|
||||
|
||||
Reference in new issue
Block a user