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 +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ private function setValue(
19
19
$ inputName = static ::convertBracketsToDots ($ name );
20
20
21
21
if (!$ language ) {
22
- $ default = $ this ->getBoundValue ($ bind , $ name ) ?: $ default ;
22
+ $ boundValue = $ this ->getBoundValue ($ bind , $ name );
23
+
24
+ $ default = is_null ($ boundValue ) ? $ default : $ boundValue ;
23
25
24
26
return $ this ->value = old ($ inputName , $ default );
25
27
}
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ public function it_can_bind_a_target_to_the_form()
23
23
->seeElement ('input[name="radio"]:checked ' );
24
24
}
25
25
26
+ /** @test */
27
+ public function it_sets_the_right_value_if_the_value_is_zero ()
28
+ {
29
+ $ this ->registerTestRoute ('bind-target-zero-value ' );
30
+
31
+ $ this ->visit ('/bind-target-zero-value ' )
32
+ ->seeElement ('input[name="input"][value="0"] ' );
33
+ }
34
+
26
35
/** @test */
27
36
public function it_overrides_the_bound_target_with_the_old_request_data ()
28
37
{
Original file line number Diff line number Diff line change
1
+ @php
2
+ $target = [
3
+ ' input' => 0 ,
4
+ ];
5
+ @endphp
6
+
7
+ <x-form >
8
+ @bind ($target )
9
+ <x-form-input name =" input" />
10
+ <x-form-submit />
11
+ @endbind
12
+ </x-form >
You can’t perform that action at this time.
0 commit comments