File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function __construct(
2727
2828 $ inputName = static ::convertBracketsToDots ($ name );
2929
30- if (old ($ inputName )) {
30+ if (old ($ inputName ) !== null ) {
3131 $ this ->checked = old ($ inputName ) == $ value ;
3232 }
3333
Original file line number Diff line number Diff line change @@ -42,4 +42,20 @@ public function it_does_check_the_right_input_element_after_a_validation_error()
4242 ->seeElement ('input[value="a"]:not(:checked) ' )
4343 ->seeElement ('input[value="b"]:checked ' );
4444 }
45+
46+ /** @test */
47+ public function it_does_check_the_right_input_element_after_a_validation_error_of_another_field ()
48+ {
49+ $ this ->registerTestRoute ('radio-with-zero-value ' , function (Request $ request ) {
50+ $ data = $ request ->validate ([
51+ 'input ' => 'required ' ,
52+ ]);
53+ });
54+
55+ $ this ->visit ('/radio-with-zero-value ' )
56+ ->select ('0 ' , 'radio ' )
57+ ->press ('Submit ' )
58+ ->seeElement ('input[value="0"]:checked ' )
59+ ->seeElement ('input[value="1"]:not(:checked) ' );
60+ }
4561}
Original file line number Diff line number Diff line change 1+ <x-form >
2+ <x-form-input name =" input" />
3+
4+ <x-form-group >
5+ <x-form-radio name =" radio" value =" 0" />
6+ <x-form-radio name =" radio" value =" 1" />
7+ </x-form-group >
8+
9+ <x-form-submit />
10+ </x-form >
You can’t perform that action at this time.
0 commit comments