Compare commits

...
2 Commits
Author SHA1 Message Date
mlantz 4aae8fb438 Fixes for #337 and #259 2017-05-19 04:15:59 -04:00
mlantz c0dc174809 Fix for #337 2017-05-19 03:41:28 -04:00
2 changed files with 8 additions and 1 deletions

No files matched your search

+7
View File
@@ -739,6 +739,8 @@ class FormBuilder
{
if (is_array($selected)) {
return in_array($value, $selected) ? 'selected' : null;
} elseif ($selected instanceof Collection) {
return $selected->contains($value) ? 'selected' : null;
}
return ((string) $value == (string) $selected) ? 'selected' : null;
@@ -1108,6 +1110,10 @@ class FormBuilder
*/
public function getValueAttribute($name, $value = null)
{
if ($name == '_token') {
return $this->csrfToken;
}
if (is_null($name)) {
return $value;
}
@@ -1124,6 +1130,7 @@ class FormBuilder
if ($hasNullMiddleware
&& is_null($old)
&& is_null($value)
&& !is_null($this->view->shared('errors'))
&& count($this->view->shared('errors')) > 0
) {
+1 -1
View File
@@ -361,7 +361,7 @@ class FormBuilderTest extends PHPUnit_Framework_TestCase
$select = $this->formBuilder->select('size', $list, 'S');
$this->assertEquals($select,
'<select name="size"><option value="L">Large</option><option value="M" selected="selected">Medium</option><option value="S">Small</option></select>');
// its likely that the mock has been changed so its not replicating correctly anymore
$session->shouldReceive('getOldInput')->once()->with('size.multi')->andReturn(['L', 'S']);
$select = $this->formBuilder->select('size[multi][]', $list, 'M', ['multiple' => 'multiple']);
$this->assertEquals($select,