This repository was archived by the owner on Mar 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +54
-9
lines changed Expand file tree Collapse file tree 6 files changed +54
-9
lines changed Original file line number Diff line number Diff line change 15
15
<directory >tests</directory >
16
16
</testsuite >
17
17
</testsuites >
18
+
19
+ <php >
20
+ <server name =" APP_ENV" value =" testing" />
21
+ <server name =" APP_KEY" value =" base64:b8TAmUGiTc/sz0jcZPJMOc52UqabMelOgKe6PChueVI=" />
22
+ </php >
18
23
</phpunit >
Original file line number Diff line number Diff line change @@ -40,8 +40,12 @@ public function custom_attributes_are_applied_to_the_button(): void
40
40
/** @test */
41
41
public function can_have_a_wire_model_instead_of_value (): void
42
42
{
43
- $ this ->blade ('<x-switch-toggle id="foo" wire:model="foo" /> ' )
44
- ->assertSee ('value: @entangle($attributes->wire( \'model \')) ' , false );
43
+ $ template = <<<HTML
44
+ <x-switch-toggle id="foo" wire:model="foo" />
45
+ HTML ;
46
+
47
+ $ this ->blade ('<livewire:blank-livewire-component :template="$template" /> ' , ['template ' => $ template ])
48
+ ->assertSee ('value: window.Livewire.find( ' );
45
49
}
46
50
47
51
/** @test */
Original file line number Diff line number Diff line change 7
7
use BladeUI \Heroicons \BladeHeroiconsServiceProvider ;
8
8
use BladeUI \Icons \BladeIconsServiceProvider ;
9
9
use Illuminate \Foundation \Testing \Concerns \InteractsWithViews ;
10
+ use Livewire \Livewire ;
11
+ use Livewire \LivewireServiceProvider ;
10
12
use Orchestra \Testbench \TestCase ;
11
13
use Rawilk \FormComponents \FormComponentsServiceProvider ;
14
+ use Rawilk \FormComponents \Tests \Components \Support \BlankLivewireComponent ;
12
15
use ReflectionProperty ;
13
- use Spatie \LaravelRay \RayServiceProvider ;
14
16
15
17
abstract class ComponentTestCase extends TestCase
16
18
{
@@ -22,6 +24,8 @@ protected function setUp(): void
22
24
23
25
$ this ->initSession ();
24
26
$ this ->artisan ('view:clear ' );
27
+
28
+ Livewire::component ('blank-livewire-component ' , BlankLivewireComponent::class);
25
29
}
26
30
27
31
protected function initSession (): void
@@ -45,6 +49,7 @@ protected function getPackageProviders($app): array
45
49
// RayServiceProvider::class,
46
50
BladeIconsServiceProvider::class,
47
51
BladeHeroiconsServiceProvider::class,
52
+ LivewireServiceProvider::class,
48
53
FormComponentsServiceProvider::class,
49
54
];
50
55
}
Original file line number Diff line number Diff line change @@ -110,9 +110,14 @@ public function hidden_inputs_are_rendered_without_a_wire_model_or_x_model_prese
110
110
/** @test */
111
111
public function hidden_inputs_are_not_rendered_with_model_binding_present (): void
112
112
{
113
- $ this ->blade ('<x-custom-select name="foo" wire:model="foo" /> ' )
114
- ->assertSee ('_wire: ' )
115
- ->assertSee ('value: @entangle($attributes->wire( \'model \')) ' , false )
113
+ $ template = <<<HTML
114
+ <x-custom-select name="foo" wire:model="foo" />
115
+ HTML ;
116
+
117
+ $ this ->blade ('<livewire:blank-livewire-component :template="$template" /> ' , ['template ' => $ template ])
118
+ ->assertSee ('_wire: window.livewire.find( ' )
119
+ ->assertSee ('value: window.Livewire.find( ' )
120
+ ->assertDontSee ('_wireModelName: \'foo \'' )
116
121
->assertDontSee ('<input type="hidden" name="foo" x-bind:value="value"> ' , false );
117
122
118
123
$ this ->blade ('<x-custom-select name="foo" x-model="foo" /> ' )
Original file line number Diff line number Diff line change @@ -55,9 +55,14 @@ public function hidden_inputs_are_rendered_without_a_wire_model_or_x_model_prese
55
55
/** @test */
56
56
public function hidden_inputs_are_not_rendered_with_model_binding_present (): void
57
57
{
58
- $ this ->blade ('<x-tree-select name="foo" wire:model.defer="foo" /> ' )
59
- ->assertSee ('_wire: ' )
60
- ->assertSee ('value: @entangle($attributes->wire( \'model \')) ' , false )
58
+ $ template = <<<HTML
59
+ <x-tree-select name="foo" wire:model.defer="foo" />
60
+ HTML ;
61
+
62
+ $ this ->blade ('<livewire:blank-livewire-component :template="$template" /> ' , ['template ' => $ template ])
63
+ ->assertSee ('_wire: window.livewire.find( ' )
64
+ ->assertSee ('value: window.Livewire.find( ' )
65
+ ->assertSee ('_wireModelName: \'foo \'' , false )
61
66
->assertDontSee ('<input type="hidden" name="foo" x-bind:value="value"> ' , false );
62
67
63
68
$ this ->blade ('<x-tree-select name="foo" x-model.debounce="foo" /> ' )
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Rawilk \FormComponents \Tests \Components \Support ;
6
+
7
+ use Livewire \Component ;
8
+
9
+ final class BlankLivewireComponent extends Component
10
+ {
11
+ public $ template ;
12
+
13
+ public function render (): string
14
+ {
15
+ return <<<HTML
16
+ <div>
17
+ {$ this ->template }
18
+ </div>
19
+ HTML ;
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments