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 1515 <directory >tests</directory >
1616 </testsuite >
1717 </testsuites >
18+
19+ <php >
20+ <server name =" APP_ENV" value =" testing" />
21+ <server name =" APP_KEY" value =" base64:b8TAmUGiTc/sz0jcZPJMOc52UqabMelOgKe6PChueVI=" />
22+ </php >
1823</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
4040 /** @test */
4141 public function can_have_a_wire_model_instead_of_value (): void
4242 {
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( ' );
4549 }
4650
4751 /** @test */
Original file line number Diff line number Diff line change 77use BladeUI \Heroicons \BladeHeroiconsServiceProvider ;
88use BladeUI \Icons \BladeIconsServiceProvider ;
99use Illuminate \Foundation \Testing \Concerns \InteractsWithViews ;
10+ use Livewire \Livewire ;
11+ use Livewire \LivewireServiceProvider ;
1012use Orchestra \Testbench \TestCase ;
1113use Rawilk \FormComponents \FormComponentsServiceProvider ;
14+ use Rawilk \FormComponents \Tests \Components \Support \BlankLivewireComponent ;
1215use ReflectionProperty ;
13- use Spatie \LaravelRay \RayServiceProvider ;
1416
1517abstract class ComponentTestCase extends TestCase
1618{
@@ -22,6 +24,8 @@ protected function setUp(): void
2224
2325 $ this ->initSession ();
2426 $ this ->artisan ('view:clear ' );
27+
28+ Livewire::component ('blank-livewire-component ' , BlankLivewireComponent::class);
2529 }
2630
2731 protected function initSession (): void
@@ -45,6 +49,7 @@ protected function getPackageProviders($app): array
4549 // RayServiceProvider::class,
4650 BladeIconsServiceProvider::class,
4751 BladeHeroiconsServiceProvider::class,
52+ LivewireServiceProvider::class,
4853 FormComponentsServiceProvider::class,
4954 ];
5055 }
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
110110 /** @test */
111111 public function hidden_inputs_are_not_rendered_with_model_binding_present (): void
112112 {
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 \'' )
116121 ->assertDontSee ('<input type="hidden" name="foo" x-bind:value="value"> ' , false );
117122
118123 $ 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
5555 /** @test */
5656 public function hidden_inputs_are_not_rendered_with_model_binding_present (): void
5757 {
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 )
6166 ->assertDontSee ('<input type="hidden" name="foo" x-bind:value="value"> ' , false );
6267
6368 $ 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