This repository was archived by the owner on Jan 2, 2024. It is now read-only.
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(
27
27
28
28
$ inputName = static ::convertBracketsToDots ($ name );
29
29
30
- if (old ($ inputName )) {
30
+ if (old ($ inputName ) !== null ) {
31
31
$ this ->checked = old ($ inputName ) == $ value ;
32
32
}
33
33
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()
42
42
->seeElement ('input[value="a"]:not(:checked) ' )
43
43
->seeElement ('input[value="b"]:checked ' );
44
44
}
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
+ }
45
61
}
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