repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/InputSelect/Component.php
legacy_tests/Browser/DataBinding/InputSelect/Component.php
<?php namespace LegacyTests\Browser\DataBinding\InputSelect; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $single; public $singleValue; public $singleNumber = 3; public $placeholder = ''; public $multiple = []; public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/Lazy/LazyInputsWithUpdatesDisplayedComponent.php
legacy_tests/Browser/DataBinding/Lazy/LazyInputsWithUpdatesDisplayedComponent.php
<?php namespace LegacyTests\Browser\DataBinding\Lazy; use Livewire\Component as BaseComponent; class LazyInputsWithUpdatesDisplayedComponent extends BaseComponent { public $name; public $description; public $is_active = false; public $updates = []; public function updated() { $this->updateUpdates(); } public function submit() { $this->updateUpdates(); } function updateUpdates() { // To keep the test from V2, I'm going to massage the V3 schema update data // back into the V2 schema here... $this->updates = []; foreach (request('components.0.updates') as $key => $value) { $this->updates[] = ['type' => 'syncInput', 'payload' => ['name' => $key]]; } foreach (request('components.0.calls') as $call) { $this->updates[] = ['type' => 'callMethod', 'payload' => ['method' => $call['method']]]; } } public function render() { return <<<'HTML' <div> <input dusk="name" wire:model.lazy="name"> <input dusk="description" wire:model.lazy="description"> <input dusk="is_active" type="checkbox" wire:model.live="is_active"> <div dusk="totalNumberUpdates">{{ count($updates) }}</div> <div dusk="updatesList"> @foreach($updates as $update) <div> @if($update['type'] == 'syncInput') {{ $update['type'] . ' - ' . $update['payload']['name'] }} @elseif($update['type'] == 'callMethod') {{ $update['type'] . ' - ' . $update['payload']['method'] }} @endif </div> @endforeach </div> <button dusk="submit" type="button" wire:click="submit">Submit</button> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/Lazy/Test.php
legacy_tests/Browser/DataBinding/Lazy/Test.php
<?php namespace LegacyTests\Browser\DataBinding\Lazy; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test_it_only_sends_updates_for_fields_that_have_been_changed_upon_submit() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, LazyInputsWithUpdatesDisplayedComponent::class) ->type('@name', 'bob') ->waitForLivewire()->click('@submit') ->assertSeeIn('@totalNumberUpdates', 3) ->assertSeeIn('@updatesList', 'syncInput - name') ->assertSeeIn('@updatesList', 'callMethod - $commit') ->assertDontSeeIn('@updatesList', 'syncInput - description') ->assertSeeIn('@updatesList', 'callMethod - submit') ->type('@description', 'Test') ->waitForLivewire()->click('@submit') ->assertSeeIn('@totalNumberUpdates', 3) ->assertDontSeeIn('@updatesList', 'syncInput - name') ->assertSeeIn('@updatesList', 'syncInput - description') ->assertSeeIn('@updatesList', 'callMethod - $commit') ->assertSeeIn('@updatesList', 'callMethod - submit') ; }); } public function test_it_sends_input_lazy_request_before_checkbox_request_in_the_same_request() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, LazyInputsWithUpdatesDisplayedComponent::class) ->type('@name', 'bob') ->waitForLivewire()->check('@is_active') ->assertSeeIn('@totalNumberUpdates', 4) ->assertSeeIn('@updatesList', 'syncInput - name') ->assertSeeIn('@updatesList', 'syncInput - is_active') ->assertSeeIn('@updatesList', 'callMethod - $commit') ->assertSeeIn('@updatesList', 'callMethod - $commit') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/Defer/Test.php
legacy_tests/Browser/DataBinding/Defer/Test.php
<?php namespace LegacyTests\Browser\DataBinding\Defer; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * Basic wire:model.defer */ ->type('@foo', 'foo') ->click('@foo.output') ->pause(150) ->assertDontSeeIn('@foo.output', 'foo') ->waitForLivewire()->click('@refresh') ->assertSeeIn('@foo.output', 'foo') /** * wire:model.defer on two checkboxes */ ->assertNotChecked('@bar.a') ->assertNotChecked('@bar.b') ->check('@bar.a') ->check('@bar.b') ->click('@bar.output') ->pause(150) ->assertDontSeeIn('@bar.output', $expectation = '["a","b"]') ->waitForLivewire()->click('@refresh') ->assertSeeIn('@bar.output', $expectation) ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/Defer/view.blade.php
legacy_tests/Browser/DataBinding/Defer/view.blade.php
<div> <input type="text" wire:model="foo" dusk="foo"> <button type="button" dusk="foo.output">{{ $foo }}</button> <input type="checkbox" wire:model="bar" value="a" dusk="bar.a"> <input type="checkbox" wire:model="bar" value="b" dusk="bar.b"> <button type="button" dusk="bar.output">@json($bar)</button> <button wire:click="$refresh" dusk="refresh">Refresh</button> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/DataBinding/Defer/Component.php
legacy_tests/Browser/DataBinding/Defer/Component.php
<?php namespace LegacyTests\Browser\DataBinding\Defer; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $foo = ''; public $bar = []; public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/GlobalLivewire/Test.php
legacy_tests/Browser/GlobalLivewire/Test.php
<?php namespace LegacyTests\Browser\GlobalLivewire; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: Caleb needs to think more deeply about JS hooks for V3... $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * Event listeners are removed on teardown. **/ ->pause(250) ->tap(function ($b) { $b->script('window.Livewire.stop()'); }) ->click('@foo') ->pause(100) ->assertDontSeeIn('@output', 'foo') ->refresh() /** * Rescanned components dont register twice. **/ ->tap(function ($b) { $b->script('window.Livewire.rescan()'); }) ->waitForLivewire()->click('@foo') ->assertSeeIn('@output', 'foo') ->refresh() /** * window.Livewire.onLoad callback is called when Livewire is initialized */ ->assertScript('window.isLoaded', true) /** * livewire:load DOM event is fired after start */ ->assertScript('window.loadEventWasFired', true) ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/GlobalLivewire/view.blade.php
legacy_tests/Browser/GlobalLivewire/view.blade.php
<div> <button wire:click="$set('output', 'foo')" dusk="foo">foo</button> <span dusk="output">{{ $output }}</span> </div> @push('scripts') <script> window.isLoaded = false window.loadEventWasFired = false window.Livewire.onLoad(() => { window.isLoaded = true }) document.addEventListener("livewire:load", function(event) { window.loadEventWasFired = true }); </script> @endpush
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/GlobalLivewire/Component.php
legacy_tests/Browser/GlobalLivewire/Component.php
<?php namespace LegacyTests\Browser\GlobalLivewire; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $output = ''; public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/SupportEnums/Test.php
legacy_tests/Browser/SupportEnums/Test.php
<?php namespace LegacyTests\Browser\SupportEnums; use LegacyTests\TestEnum; use Livewire\Component; use Livewire\Livewire; use Tests\TestCase; class Test extends TestCase { public function test() { Livewire::test(new class extends Component { public $enum; public function mount() { $this->enum = TestEnum::TEST; } public function render() { return <<<'HTML' <div> {{ $enum->value }} </div> HTML; } }) ->assertSee('Be excellent to each other') ; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/component-with-traits.blade.php
legacy_tests/Browser/QueryString/component-with-traits.blade.php
<div> <input wire:model.live="search" type="text" dusk="search"> @foreach ($posts as $post) <h1 wire:key="post-{{ $post->id }}">{{ $post->title }}</h1> @endforeach {{ $posts->links() }} </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/excepts.blade.php
legacy_tests/Browser/QueryString/excepts.blade.php
<div> <span dusk="output">On page {{ $page }}</span> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/NestedComponent.php
legacy_tests/Browser/QueryString/NestedComponent.php
<?php namespace LegacyTests\Browser\QueryString; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class NestedComponent extends BaseComponent { public $baz = 'bop'; protected $queryString = ['baz' => ['history' => true, 'keep' => true]]; public function render() { return View::file(__DIR__.'/nested-view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/Test.php
legacy_tests/Browser/QueryString/Test.php
<?php namespace LegacyTests\Browser\QueryString; use Sushi\Sushi; use LegacyTests\Browser\TestCase; use Laravel\Dusk\Browser; use Illuminate\Database\Eloquent\Model; class Test extends TestCase { public function test_core_query_string_pushstate_logic() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, [Component::class, 'nested' => NestedComponent::class], '?foo=baz&eoo=lob') /* * Check that the intial property value is set from the query string. */ ->assertSeeIn('@output', 'baz') ->assertInputValue('@input', 'baz') /* * Check that Livewire doesn't mess with query string order. */ ->assertScript('return !! window.location.search.match(/foo=baz&eoo=lob/)') /** * Change a property and see it reflected in the query string. */ ->waitForLivewire()->type('@input', 'bob') ->assertSeeIn('@output', 'bob') ->assertInputValue('@input', 'bob') ->assertQueryStringHas('foo', 'bob') /** * Hit the back button and see the change reflected in both * the query string AND the actual property value. */ ->waitForLivewire()->back() ->assertSeeIn('@output', 'baz') ->assertQueryStringHas('foo', 'baz') /** * Setting a property BACK to it's original value * removes the property entirely from the query string. * As long as it wasn't there to begin with... */ ->assertSeeIn('@bar-output', 'baz') ->waitForLivewire()->type('@bar-input', 'new-value') ->assertQueryStringHas('bar') ->waitForLivewire()->type('@bar-input', 'baz') ->assertQueryStringMissing('bar') /** * Add a nested component on the page and make sure * both components play nice with each other. */ ->assertQueryStringMissing('baz') ->waitForLivewire()->click('@show-nested') ->pause(25) ->assertSeeIn('@baz-output', 'bop') ->waitForLivewire()->type('@baz-input', 'lop') ->assertQueryStringHas('baz', 'lop') ->waitForLivewire()->type('@input', 'plop') ->waitForLivewire()->type('@baz-input', 'ploop') ->assertQueryStringHas('foo', 'plop') ->assertQueryStringHas('baz', 'ploop') ->waitForLivewire()->back() ->waitForLivewire()->back() ->assertQueryStringHas('baz', 'lop') /** * Can change an array property. */ ->assertSeeIn('@bob.output', '["foo","bar"]') ->waitForLivewire()->click('@bob.modify') ->assertSeeIn('@bob.output', '["foo","bar","baz"]') ->refresh() ->assertSeeIn('@bob.output', '["foo","bar","baz"]') ; }); } public function test_query_string_format_in_rfc_1738() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, Component::class) ->waitForLivewire()->type('@input', 'foo bar') ->assertSeeIn('@output', 'foo bar') ->assertInputValue('@input', 'foo bar') ->assertQueryStringHas('foo', 'foo bar') ->assertScript('return !! window.location.search.match(/foo=foo\+bar/)') ->assertScript('return !! window.location.search.match(/quux%26quuz/)') ; }); } public function test_query_string_with_rfc_1738_bookmarked_url() { $this->browse(function (Browser $browser) { $queryString = '?qux[hyphen]=quux-quuz&qux[comma]=quux,quuz&qux[ampersand]=quux%26quuz&qux[space]=quux+quuz&qux[array][0]=quux&qux[array][1]=quuz'; $this->visitLivewireComponent($browser, Component::class, $queryString) ->assertSeeIn('@qux.hyphen', 'quux-quuz') ->assertSeeIn('@qux.comma', 'quux,quuz') ->assertSeeIn('@qux.ampersand', 'quux&quuz') ->assertSeeIn('@qux.space', 'quux quuz') ->assertSeeIn('@qux.array', '["quux","quuz"]') ; }); } public function test_query_string_with_rfc_3986_bookmarked_url_forbackwards_compatibility() { $this->browse(function (Browser $browser) { $queryString = '?qux%5Bhyphen%5D=quux-quuz&qux%5Bcomma%5D=quux%2Cquuz&qux%5Bampersand%5D=quux%26quuz&qux%5Bspace%5D=quux%20quuz&qux%5Barray%5D%5B%5D=quux&qux%5Barray%5D%5B%5D=quuz'; $this->visitLivewireComponent($browser, Component::class, $queryString) ->assertSeeIn('@qux.hyphen', 'quux-quuz') ->assertSeeIn('@qux.comma', 'quux,quuz') ->assertSeeIn('@qux.ampersand', 'quux&quuz') ->assertSeeIn('@qux.space', 'quux quuz') ->assertSeeIn('@qux.array', '["quux","quuz"]') ; }); } public function test_query_string_with_property_values_containing_ampersand_characters() { $this->browse(function (Browser $browser) { $queryString = '?foo=bar%26quux%26quuz'; $this->visitLivewireComponent($browser, Component::class, $queryString) ->assertSeeIn('@output', 'bar&quux&quuz') ->refresh() ->assertSeeIn('@output', 'bar&quux&quuz') ; }); } public function test_back_button_after_refresh_works_with_nested_components() { $this->markTestSkipped(); // @todo: fix this... $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, [Component::class, 'nested' => NestedComponent::class]) ->waitForLivewire()->click('@show-nested') ->waitForLivewire()->type('@baz-input', 'foo') ->assertSeeIn('@baz-output', 'foo') ->refresh() ->back() ->forward() ->assertSeeIn('@baz-output', 'foo') // Interact with the page again to make sure everything still works. ->waitForLivewire()->type('@baz-input', 'bar') ->assertSeeIn('@baz-output', 'bar') ; }); } // public function test_excepts_results_in_no_query_string() // { // $this->browse(function (Browser $browser) { // $this->visitLivewireComponent($browser, ComponentWithExcepts::class) // ->assertSeeIn('@output', 'On page 1'); // $this->assertStringNotContainsString('?', $browser->driver->getCurrentURL()); // $this->visitLivewireComponent($browser, ComponentWithExcepts::class, '?page=1') // ->assertSeeIn('@output', 'On page 1'); // $this->assertStringNotContainsString('?', $browser->driver->getCurrentURL()); // $this->visitLivewireComponent($browser, ComponentWithExcepts::class, '?page=2') // ->assertSeeIn('@output', 'On page 2') // ->assertQueryStringHas('page', 2); // }); // } public function test_that_input_values_are_set_after_back_button() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, DirtyDataComponent::class) ->waitForLivewire()->type('@input', 'foo') ->waitForLivewire()->click('@nextPage') ->assertSee('The Next Page') ->back() ->waitFor('@input') ->assertInputValue('@input', 'foo') ->forward() ->back() ->waitFor('@input') ->assertInputValue('@input', 'foo') ; }); } public function test_dynamic_query_string_method() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, ComponentWithMethodInsteadOfProperty::class) ->assertQueryStringHas('foo', 'bar') ; }); } public function test_nested_component_query_string_works_when_parent_is_not_using_query_string() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, [ParentComponentWithNoQueryString::class, 'nested' => NestedComponent::class]) ->assertPathBeginsWith('/livewire-dusk') ->waitForLivewire()->click('@toggle-nested') // assert the path hasn't change to /livewire/message ->assertPathBeginsWith('/livewire-dusk') ->assertQueryStringHas('baz', 'bop') ; }); } public function test_it_does_not_build_query_string_from_referer_if_it_is_coming_from_a_full_page_redirect() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, RedirectLinkToQueryStringComponent::class) ->assertPathBeginsWith('/livewire-dusk/LegacyTests%5CBrowser%5CQueryString%5CRedirectLinkToQueryStringComponent') ->click('@link') ->pause(200) // assert the path has changed to new component path ->assertPathBeginsWith('/livewire-dusk/LegacyTests%5CBrowser%5CQueryString%5CNestedComponent') ->assertQueryStringHas('baz', 'bop') ; }); } public function test_query_string_hooks_from_traits() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, ComponentWithTraits::class) ->assertSee('Post #1') ->assertSee('Post #2') ->assertSee('Post #3') ->assertQueryStringMissing('search') // Search for posts where title contains "1". ->waitForLivewire()->type('@search', '1') ->assertSee('Post #1') ->assertSee('Post #10') ->assertSee('Post #11') ->assertDontSee('Post #2') ->assertDontSee('Post #3') ->assertQueryStringHas('search', '1') // Search for posts where title contains "42". ->waitForLivewire()->type('@search', '42') ->assertSee('Post #42') ->assertQueryStringHas('search', '42') ; }); } public function test_query_string_aliases() { $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, ComponentWithAliases::class) ->assertQueryStringMissing('s') // Search for posts where title contains "1". ->waitForLivewire()->type('@search', '1') ->assertQueryStringHas('s', '1') ->assertInputValue('@search', '1') // Search for posts where title contains "qwerty". ->waitForLivewire()->type('@search', 'qwerty') ->assertQueryStringHas('s', 'qwerty') ->assertInputValue('@search', 'qwerty') ; }); } } class Post extends Model { use Sushi; protected $rows = [ ['title' => 'Post #1'], ['title' => 'Post #2'], ['title' => 'Post #3'], ['title' => 'Post #4'], ['title' => 'Post #5'], ['title' => 'Post #6'], ['title' => 'Post #7'], ['title' => 'Post #8'], ['title' => 'Post #9'], ['title' => 'Post #10'], ['title' => 'Post #11'], ['title' => 'Post #12'], ['title' => 'Post #13'], ['title' => 'Post #14'], ['title' => 'Post #15'], ['title' => 'Post #16'], ['title' => 'Post #17'], ['title' => 'Post #18'], ['title' => 'Post #19'], ['title' => 'Post #20'], ['title' => 'Post #21'], ['title' => 'Post #22'], ['title' => 'Post #23'], ['title' => 'Post #24'], ['title' => 'Post #25'], ['title' => 'Post #26'], ['title' => 'Post #27'], ['title' => 'Post #28'], ['title' => 'Post #29'], ['title' => 'Post #30'], ['title' => 'Post #31'], ['title' => 'Post #32'], ['title' => 'Post #33'], ['title' => 'Post #34'], ['title' => 'Post #35'], ['title' => 'Post #36'], ['title' => 'Post #37'], ['title' => 'Post #38'], ['title' => 'Post #39'], ['title' => 'Post #40'], ['title' => 'Post #41'], ['title' => 'Post #42'], ['title' => 'Post #43'], ['title' => 'Post #44'], ['title' => 'Post #45'], ['title' => 'Post #46'], ['title' => 'Post #47'], ['title' => 'Post #48'], ['title' => 'Post #49'], ['title' => 'Post #50'], ['title' => 'Post #51'], ['title' => 'Post #52'], ['title' => 'Post #53'], ['title' => 'Post #54'], ['title' => 'Post #55'], ['title' => 'Post #56'], ['title' => 'Post #57'], ['title' => 'Post #58'], ['title' => 'Post #59'], ['title' => 'Post #60'], ]; } class Item extends Model { use Sushi; protected $rows = [ ['title' => 'Item #1'], ['title' => 'Item #2'], ['title' => 'Item #3'], ['title' => 'Item #4'], ['title' => 'Item #5'], ['title' => 'Item #6'], ['title' => 'Item #7'], ['title' => 'Item #8'], ['title' => 'Item #9'], ['title' => 'Item #10'], ['title' => 'Item #11'], ['title' => 'Item #12'], ['title' => 'Item #13'], ['title' => 'Item #14'], ['title' => 'Item #15'], ['title' => 'Item #16'], ['title' => 'Item #17'], ['title' => 'Item #18'], ['title' => 'Item #19'], ['title' => 'Item #20'], ['title' => 'Item #21'], ['title' => 'Item #22'], ['title' => 'Item #23'], ['title' => 'Item #24'], ['title' => 'Item #25'], ['title' => 'Item #26'], ['title' => 'Item #27'], ['title' => 'Item #28'], ['title' => 'Item #29'], ['title' => 'Item #30'], ['title' => 'Item #31'], ['title' => 'Item #32'], ['title' => 'Item #33'], ['title' => 'Item #34'], ['title' => 'Item #35'], ['title' => 'Item #36'], ['title' => 'Item #37'], ['title' => 'Item #38'], ['title' => 'Item #39'], ['title' => 'Item #40'], ['title' => 'Item #41'], ['title' => 'Item #42'], ['title' => 'Item #43'], ['title' => 'Item #44'], ['title' => 'Item #45'], ['title' => 'Item #46'], ['title' => 'Item #47'], ['title' => 'Item #48'], ['title' => 'Item #49'], ['title' => 'Item #50'], ['title' => 'Item #51'], ['title' => 'Item #52'], ['title' => 'Item #53'], ['title' => 'Item #54'], ['title' => 'Item #55'], ['title' => 'Item #56'], ['title' => 'Item #57'], ['title' => 'Item #58'], ['title' => 'Item #59'], ['title' => 'Item #60'], ]; }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/WithSearch.php
legacy_tests/Browser/QueryString/WithSearch.php
<?php namespace LegacyTests\Browser\QueryString; trait WithSearch { /** * @var string */ public $search = ''; /** * @var array */ protected $queryStringWithSearch = ['search' => []]; /** * @return void */ public function initializeWithSearch() { $this->search = request()->query('search', $this->search); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/RedirectLinkToQueryStringComponent.php
legacy_tests/Browser/QueryString/RedirectLinkToQueryStringComponent.php
<?php namespace LegacyTests\Browser\QueryString; use Livewire\Component as BaseComponent; class RedirectLinkToQueryStringComponent extends BaseComponent { public $showNestedComponent = false; public function render() { return <<< 'HTML' <div> <a dusk="link" href="{{ url('/livewire-dusk/LegacyTests%5CBrowser%5CQueryString%5CNestedComponent') }}">Link</a> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/ComponentWithTraits.php
legacy_tests/Browser/QueryString/ComponentWithTraits.php
<?php namespace LegacyTests\Browser\QueryString; use Illuminate\Support\Facades\View; use Livewire\Component; use Livewire\WithPagination; class ComponentWithTraits extends Component { use WithPagination; use WithSearch; public function render() { return View::file(__DIR__.'/component-with-traits.blade.php', [ 'posts' => Post::query() ->when($this->search, function ($query, $search) { $query->where('title', 'LIKE', "%$search%"); }) ->paginate(3), ]); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/nested-view.blade.php
legacy_tests/Browser/QueryString/nested-view.blade.php
<div> <span dusk="baz-output">{{ $baz }}</span> <input wire:model.live="baz" type="text" dusk="baz-input"> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/DirtyDataComponent.php
legacy_tests/Browser/QueryString/DirtyDataComponent.php
<?php namespace LegacyTests\Browser\QueryString; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class DirtyDataComponent extends BaseComponent { protected $queryString = ['page' => ['history' => true]]; public $page = 1; public $foo = ['bar' => '']; public function nextPage() { $this->page++; } public function render() { return View::file(__DIR__.'/dirty-data.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/ComponentWithAliases.php
legacy_tests/Browser/QueryString/ComponentWithAliases.php
<?php namespace LegacyTests\Browser\QueryString; class ComponentWithAliases extends ComponentWithTraits { protected $queryString = [ 'search' => ['as' => 's'], ]; }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/dirty-data.blade.php
legacy_tests/Browser/QueryString/dirty-data.blade.php
<div> <button wire:click="nextPage" dusk="nextPage">Next Page</button> @if ($page === 1) <div> <input type="text" wire:model.live="foo.bar" dusk="input"> </div> @else <div> The Next Page </div> @endif </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/ComponentWithExcepts.php
legacy_tests/Browser/QueryString/ComponentWithExcepts.php
<?php namespace LegacyTests\Browser\QueryString; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class ComponentWithExcepts extends BaseComponent { public $page = 1; protected $queryString = ['page' => ['except' => 1]]; public function render() { return View::file(__DIR__.'/excepts.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/ParentComponentWithNoQueryString.php
legacy_tests/Browser/QueryString/ParentComponentWithNoQueryString.php
<?php namespace LegacyTests\Browser\QueryString; use Livewire\Component as BaseComponent; class ParentComponentWithNoQueryString extends BaseComponent { public $showNestedComponent = false; public function render() { return <<< 'HTML' <div> <button type="button" wire:click="$toggle('showNestedComponent')" dusk="toggle-nested">Toggle Nested</button> <div> @if ($showNestedComponent) @livewire('nested') @endif </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/ComponentWithMethodInsteadOfProperty.php
legacy_tests/Browser/QueryString/ComponentWithMethodInsteadOfProperty.php
<?php namespace LegacyTests\Browser\QueryString; use Livewire\Component as BaseComponent; class ComponentWithMethodInsteadOfProperty extends BaseComponent { public $foo = 'bar'; public function queryString() { return ['foo' => ['alwaysShow' => true]]; } public function render() { return '<div>{{ $foo }}</div>'; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/view.blade.php
legacy_tests/Browser/QueryString/view.blade.php
<div> {{-- <div x-data="{ count: $queryString(1) }"> <input type="text" x-model="count"> <span x-text="count"></span> </div> <br> <br> <br> --}} <span dusk="output">{{ $foo }}</span> <span dusk="bar-output">{{ $bar }}</span> <span dusk="qux.hyphen">{{ $qux['hyphen'] }}</span> <span dusk="qux.comma">{{ $qux['comma'] }}</span> <span dusk="qux.ampersand">{{ $qux['ampersand'] }}</span> <span dusk="qux.space">{{ $qux['space'] }}</span> <span dusk="qux.array">{{ json_encode($qux['array']) }}</span> <input wire:model.live="foo" type="text" dusk="input"> <input wire:model.live="bar" type="text" dusk="bar-input"> <button wire:click="$set('showNestedComponent', true)" dusk="show-nested">Show Nested Component</button> <button wire:click="modifyBob" dusk="bob.modify">Modify Bob (Array Property)</button> <span dusk="bob.output">@json($bob)</span> @if ($showNestedComponent) @livewire('nested') @endif </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/QueryString/Component.php
legacy_tests/Browser/QueryString/Component.php
<?php namespace LegacyTests\Browser\QueryString; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $foo = 'bar'; public $bar = 'baz'; public $bob = ['foo', 'bar']; public $qux = [ 'hyphen' => 'quux-quuz', 'comma' => 'quux,quuz', 'ampersand' => 'quux&quuz', 'space' => 'quux quuz', 'array' => [ 'quux', 'quuz' ], ]; public $showNestedComponent = false; protected $queryString = [ 'foo' => ['history' => true, 'keep' => false], 'bar' => ['history' => true, 'keep' => false], 'bob' => ['history' => true, 'keep' => true], 'qux' => ['history' => true, 'keep' => true], 'showNestedComponent' => ['history' => true, 'keep' => true], ]; public function modifyBob() { $this->bob = ['foo', 'bar', 'baz']; } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Polling/Test.php
legacy_tests/Browser/Polling/Test.php
<?php namespace LegacyTests\Browser\Polling; use Livewire\Component; use Livewire\Livewire; use Tests\BrowserTestCase; class Test extends BrowserTestCase { public function test_wire_poll() { Livewire::visit(new class extends Component { public $enabled = false; public $count = 0; public function render() { $this->count++; return <<<'HTML' <div> <button wire:click="$refresh" dusk="refresh">count++</button> <button wire:click="$set('enabled', true)" dusk="enable">enable</button> <button wire:click="$set('enabled', false)" dusk="disable">disable</button> <span dusk="output">{{ $count }}</span> @if ($enabled) <div wire:poll.500ms dusk="poll-element"></div> @endif </div> HTML; } }) /** * Enable polling by adding a wire:poll directive to an element. */ ->assertSeeIn('@output', '1') ->pause('500') // Wait the time for a wire:poll in the view. ->assertSeeIn('@output', '1') ->waitForLivewire()->click('@enable') ->assertSeeIn('@output', '2') ->assertAttributeMissing('@poll-element', 'data-loading') // Poll should not add data-loading ->waitForLivewire(function () {}) // Wait for the next Livewire roundtrip ->assertSeeIn('@output', '3') ->assertAttributeMissing('@poll-element', 'data-loading') // Still no data-loading ->waitForLivewire(function () {}) ->assertSeeIn('@output', '4') ->assertAttributeMissing('@poll-element', 'data-loading') // Still no data-loading /** * Disable polling by removing wire:poll from an element. */ ->waitForLivewire()->click('@disable') ->assertSeeIn('@output', '5') ->pause('500') ->assertSeeIn('@output', '5') /** * Re-enable polling, then test that polling stops when offline and resumes when back online. */ ->waitForLivewire()->click('@enable') ->assertSeeIn('@output', '6') ->waitForLivewire(function () {}) ->assertSeeIn('@output', '7') ->offline() ->pause('500') ->assertSeeIn('@output', '7') ->online() ->waitForLivewire(function () {}) ->assertSeeIn('@output', '8') ; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/StringNormalization/Test.php
legacy_tests/Browser/StringNormalization/Test.php
<?php namespace LegacyTests\Browser\StringNormalization; use Laravel\Dusk\Browser; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { // @todo: This test passes now, but it probably no longer needed, as we're not needing to normalise strings to prevent corrupt payload exception. // Old todo: Get test running by copying implementation from both PR's and updating to V3 style https://github.com/livewire/livewire/pull/4942 and https://github.com/livewire/livewire/pull/5379 $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, Component::class) /** * Click button to trigger string re-encoding in dehydrate */ ->waitForLivewire()->click('#add_number') ->pause('500') ->assertSee('Add Number') // current version throws an error in Safari ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/StringNormalization/Model.php
legacy_tests/Browser/StringNormalization/Model.php
<?php namespace LegacyTests\Browser\StringNormalization; use Illuminate\Database\Eloquent\Model as BaseModel; use Sushi\Sushi; class Model extends BaseModel { use Sushi; protected $rows = [ [ 'id' => 1, 'name' => 'â' ] ]; }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/StringNormalization/view.blade.php
legacy_tests/Browser/StringNormalization/view.blade.php
<div> <div>{{ $string }}</div> <div>{{ $number }}</div> <pre>{{ print_r($array, true) }}</pre> <pre>{{ print_r($recursiveArray, true) }}</pre> <pre>{{ print_r($collection->toArray(), true) }}</pre> <pre>{{ print_r($recursiveCollection->toArray(), true) }}</pre> <pre>{{ print_r($model->name, true) }}</pre> <pre>{{ print_r($modelCollection->toArray(), true) }}</pre> <button id="add_number" wire:click="addNumber">Add Number</button> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/StringNormalization/Component.php
legacy_tests/Browser/StringNormalization/Component.php
<?php namespace LegacyTests\Browser\StringNormalization; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $string = 'â'; public $number = 0; public $array = ['â']; public $recursiveArray = ['â', ['â']]; public $collection; public $recursiveCollection; public $model; public $modelCollection; public function mount() { $this->collection = collect(['â']); $this->recursiveCollection = collect(['â', ['â']]); $this->model = Model::find(1); $this->modelCollection = Model::all(); } public function render() { return View::file(__DIR__.'/view.blade.php'); } public function addNumber() { $this->number++; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Actions/Test.php
legacy_tests/Browser/Actions/Test.php
<?php namespace LegacyTests\Browser\Actions; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * Basic action (click). */ ->waitForLivewire()->click('@foo') ->assertSeeIn('@output', 'foo') /** * Action with params. */ ->waitForLivewire()->click('@bar') ->assertSeeIn('@output', 'barbell') /** * Action with various parameter formatting differences. */ ->waitForLivewire()->click('@ball') ->assertSeeIn('@output', 'abcdef') /** * Action with no params, but still parenthesis. */ ->waitForLivewire()->click('@bowl') ->assertSeeIn('@output', 'foo') /** * Action with no params, but still parenthesis and having some spaces. */ ->waitForLivewire()->click('@baw') ->assertSeeIn('@output', 'foo') /** * Action on multiple lines */ ->waitForLivewire()->click('@fizzfuzz') ->assertSeeIn('@output', 'fizzfuzz') /** * wire:click.self */ ->waitForLivewire()->click('@baz.inner') ->assertSeeIn('@output', 'fizzfuzz') ->waitForLivewire()->click('@baz.outer') ->assertSeeIn('@output', 'baz') /** * Blur event and click event get sent together */ ->click('@bop.input') // Fucus. ->assertSeeIn('@output', 'baz') ->waitForLivewire()->click('@bop.button') ->assertSeeIn('@output', 'bazbop') /** * Two keydowns */ ->waitForLivewire()->keys('@bob', '{enter}') ->assertSeeIn('@output', 'bazbopbob') /** * If listening for "enter", other keys don't trigger the action. */ ->keys('@lob', 'k') ->pause(150) ->assertDontSeeIn('@output', 'lob') ->waitForLivewire()->keys('@lob', '{enter}') ->assertSeeIn('@output', 'lob') /** * keydown.shift.enter */ ->waitForLivewire()->keys('@law', '{shift}', '{enter}') ->assertSeeIn('@output', 'law') /** * keydown.space */ ->waitForLivewire()->keys('@spa', '{space}') ->assertSeeIn('@output', 'spa') /** * Elements are marked as read-only during form submission */ ->tap(function ($b) { $this->assertNull($b->attribute('@blog.button', 'disabled')); $this->assertNull($b->attribute('@blog.input', 'readonly')); $this->assertNull($b->attribute('@blog.input.ignored', 'readonly')); }) ->waitForLivewire(function ($b) { $b->press('@blog.button'); $this->assertEquals('true', $b->attribute('@blog.button', 'disabled')); $this->assertEquals('true', $b->attribute('@blog.input', 'readonly')); $this->assertNull($b->attribute('@blog.input.ignored', 'readonly')); }) ->tap(function ($b) { $this->assertNull($b->attribute('@blog.button', 'disabled')); $this->assertNull($b->attribute('@blog.input', 'readonly')); }) /** * Elements are un-marked as readonly when form errors out. */ ->press('@boo.button') ->tap(function ($b) { $this->assertEquals('true', $b->attribute('@boo.button', 'disabled')); }) ->tap(function ($b) { $this->assertNull($b->attribute('@blog.button', 'disabled')); }) ->waitFor('#livewire-error') // Close the error modal... ->keys('#livewire-error', '{escape}') /** * keydown.debounce */ ->keys('@bap', 'x') ->pause(50) ->waitForLivewire()->assertDontSeeIn('@output', 'bap') ->assertSeeIn('@output', 'bap') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Actions/view.blade.php
legacy_tests/Browser/Actions/view.blade.php
<div> <button type="button" wire:click="setOutputToFoo" dusk="foo">Foo</button> <button type="button" wire:click="setOutputTo('bar', 'bell')" dusk="bar">Bar</button> <button type="button" wire:click="setOutputTo('a', &quot;b&quot; , 'c','d' ,'e', ''.concat('f'))" dusk="ball">Ball</button> <button type="button" wire:click="setOutputToFoo()" dusk="bowl">Bowl</button> <button type="button" wire:click="@if (1) setOutputToFoo() @else setOutputToFoo() @endif" dusk="baw">Baw</button> <button type="button" wire:click=" setOutputTo( 'fizz', 'fuzz' )" dusk="fizzfuzz">Fizz Fuzz</button> <button type="button" wire:click="setOutputTo('baz')" dusk="baz.outer"><button type="button" wire:click="$refresh" dusk="baz.inner">Inner</button> Outer</button> <input type="text" wire:blur="appendToOutput('bop')" dusk="bop.input"><button type="button" wire:mousedown="appendToOutput('bop')" dusk="bop.button">Blur &</button> <input type="text" wire:keydown="appendToOutput('bob')" wire:keydown.enter="appendToOutput('bob')" dusk="bob"> <input type="text" wire:keydown.enter="setOutputTo('lob')" dusk="lob"> <input type="text" wire:keydown.shift.enter="setOutputTo('law')" dusk="law"> <input type="text" wire:keydown.space="setOutputTo('spa')" dusk="spa"> <form wire:submit="pause"> <div wire:ignore> <input type="text" dusk="blog.input.ignored"> </div> <input type="text" dusk="blog.input"> <button type="submit" dusk="blog.button">Submit</button> </form> <form wire:submit="throwError"> <button type="submit" dusk="boo.button">Submit</button> </form> <input wire:keydown.debounce.75ms="setOutputTo('bap')" dusk="bap"></button> <span dusk="output">{{ $output }}</span> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Actions/Component.php
legacy_tests/Browser/Actions/Component.php
<?php namespace LegacyTests\Browser\Actions; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $output = ''; public function setOutputToFoo() { $this->output = 'foo'; } public function setOutputTo(...$params) { $this->output = implode('', $params); } public function appendToOutput(...$params) { $this->output .= implode('', $params); } public function pause() { usleep(1000 * 150); } public function throwError() { usleep(1000 * 150); throw new \Exception; } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Redirects/Test.php
legacy_tests/Browser/Redirects/Test.php
<?php namespace LegacyTests\Browser\Redirects; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\RefreshDatabase; use Sushi\Sushi; use LegacyTests\Browser\TestCase; class Test extends TestCase { use RefreshDatabase; public function test_it_correctly_shows_flash_messages_before_and_after_direct() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /* * Flashing a message shows up right away, AND * will show up if you redirect to a different * page right after. */ ->assertNotPresent('@flash.message') ->waitForLivewire()->click('@flash') ->assertPresent('@flash.message') ->waitForLivewire()->click('@refresh') ->assertNotPresent('@flash.message') ->click('@redirect-with-flash')->waitForReload() ->assertPresent('@flash.message') ->waitForLivewire()->click('@refresh') ->assertNotPresent('@flash.message') ; }); } } class Foo extends Model { use Sushi; protected $guarded = []; protected $rows = [ ['id' => 1, 'name' => 'foo'], ]; }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Redirects/view.blade.php
legacy_tests/Browser/Redirects/view.blade.php
<div> <button wire:click="$refresh" dusk="refresh">Refresh</button> <button wire:click="flashMessage" dusk="flash">Flash</button> <button wire:click="redirectWithFlash" dusk="redirect-with-flash">Redirect With Flash</button> <button wire:click="redirectPage" dusk="redirect.button">Redirect Page</button> <span dusk="redirect.blade.output">{{ $message }}</span> <span x-data="{ message: @entangle('message') }" x-text="message" dusk="redirect.alpine.output"></span> <button wire:click="redirectPageWithModel" dusk="redirect-with-model.button">Redirect PageWithModel</button> <span dusk="redirect.blade.model-output">{{ $foo }}</span> <span x-data="{ message: @entangle('foo') }" x-text="message" dusk="redirect.alpine.model-output"></span> <div> @if (session()->has('message')) <h1 dusk="flash.message">{{ session()->get('message') }}</h1> @endif </div> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Redirects/Component.php
legacy_tests/Browser/Redirects/Component.php
<?php namespace LegacyTests\Browser\Redirects; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $message = 'foo'; public $foo = 'hey'; public $disableBackButtonCache = true; protected $queryString = [ 'disableBackButtonCache', ]; protected $rules = [ 'foo.name' => '', ]; public function mount() { // $this->foo = Foo::first(); // Set "disable back button cache" flag based off of query string // $this->disableBackButtonCache ? Livewire::disableBackButtonCache() : Livewire::enableBackButtonCache(); } public function flashMessage() { session()->flash('message', 'some-message'); } public function redirectWithFlash() { session()->flash('message', 'some-message'); return $this->redirect('/livewire-dusk/LegacyTests%5CBrowser%5CRedirects%5CComponent'); } public function redirectPage() { $this->message = 'bar'; return $this->redirect('/livewire-dusk/LegacyTests%5CBrowser%5CRedirects%5CComponent?abc'); } public function redirectPageWithModel() { // $this->foo->update(['name' => 'bar']); $this->foo = 'bar'; return $this->redirect('/livewire-dusk/Tests%5CBrowser%5CRedirects%5CComponent?abc&disableBackButtonCache='. ($this->disableBackButtonCache ? 'true' : 'false')); } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/PollingViewport/Test.php
legacy_tests/Browser/PollingViewport/Test.php
<?php namespace LegacyTests\Browser\PollingViewport; use Laravel\Dusk\Browser; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @flaky $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, Component::class) ->assertSeeIn('@output', '1') ->waitForLivewire(function () {}) ->assertSeeIn('@output', '2') ->scrollTo('#bottom') ->pause(2000) ->scrollTo('#top') ->waitForLivewire(function () {}) ->assertSeeIn('@output', '3'); }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/PollingViewport/view.blade.php
legacy_tests/Browser/PollingViewport/view.blade.php
<div> <div id="top" style="height: 100vh"> <div wire:poll.500ms.visible> <span dusk="output">{{ $count }}</span> </div> </div> <div id="clearfix"> No, not really. </div> <div id="bottom" style="height: 100vh"> Polling not in view. </div> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/PollingViewport/Component.php
legacy_tests/Browser/PollingViewport/Component.php
<?php namespace LegacyTests\Browser\PollingViewport; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $count = 0; public function render() { $this->count++; return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/CustomDisplayProperty.php
legacy_tests/Browser/Loading/CustomDisplayProperty.php
<?php namespace LegacyTests\Browser\Loading; use Livewire\Component as BaseComponent; class CustomDisplayProperty extends BaseComponent { public function hydrate() { usleep(500 * 1000); } public function render() { return <<<'HTML' <div> <button wire:click="$refresh" dusk="refresh">Refresh</button> <span wire:loading dusk="default">Inline-block</span> <span wire:loading.inline-block dusk="inline-block">Inline-block</span> <span wire:loading.inline dusk="inline">Inline</span> <span wire:loading.block dusk="block">Block</span> <span wire:loading.flex dusk="flex">Flex</span> <span wire:loading.table dusk="table">Table</span> <span wire:loading.grid dusk="grid">Grid</span> <span wire:loading.inline-flex dusk="inline-flex">Inline-flex</span> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/Test.php
legacy_tests/Browser/Loading/Test.php
<?php namespace LegacyTests\Browser\Loading; use Laravel\Dusk\Browser; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@button'); $browser->pause(50); $browser->assertVisible('@show'); $browser->assertNotVisible('@hide'); $browser->assertHasClass('@add-class', 'foo'); $browser->assertClassMissing('@remove-class', 'hidden'); $browser->assertAttribute('@add-attr', 'disabled', 'true'); $browser->assertAttributeMissing('@remove-attr', 'disabled'); $browser->assertAttribute('@add-both', 'disabled', 'true'); $browser->assertAttributeMissing('@remove-both', 'disabled'); $browser->assertHasClass('@add-both', 'foo'); $browser->assertClassMissing('@remove-both', 'hidden'); $browser->assertNotVisible('@targeting'); $browser->assertNotVisible('@targeting-both'); $browser->assertNotVisible('@targeting-param'); $browser->assertNotVisible('@targeting-js-param'); $browser->assertClassMissing('@self-target-button', 'foo'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@button'); $browser->pause(101); $browser->assertNotVisible('@show-w-delay'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@button'); $browser->pause(225); $browser->assertVisible('@show-w-delay'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@target-button'); $browser->waitFor('@targeting'); $browser->assertVisible('@targeting-both'); $browser->assertNotVisible('@target-top-level-property'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@target-button-w-param'); $browser->waitFor('@targeting'); $browser->assertVisible('@targeting-both'); $browser->assertVisible('@targeting-param'); $browser->assertVisible('@targeting-js-param'); $browser->assertNotVisible('@target-top-level-property'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@target-button-w-js-object-param'); $browser->waitFor('@targeting'); $browser->assertVisible('@targeting-both'); $browser->assertVisible('@targeting-js-object-param'); $browser->assertNotVisible('@targeting-js-wrong-object-param'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->click('@self-target-button'); $browser->assertNotVisible('@targeting'); $browser->assertVisible('@targeting-both'); $browser->assertNotVisible('@target-top-level-property'); $browser->assertHasClass('@self-target-button', 'foo'); }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->check('@self-target-model'); $browser->assertNotVisible('@targeting'); $browser->assertNotVisible('@targeting-both'); $browser->assertNotVisible('@target-top-level-property'); $browser->assertHasClass('@self-target-model', 'foo'); }) ->tap($this->assertInitialState()) // @todo: See if this loading behavior is right for error requests... // ->waitForLivewire(function (Browser $browser) { // $browser->click('@error-button'); // $browser->pause(1); // $browser->assertNotVisible('@hide'); // $browser->assertVisible('@show'); // $browser->waitFor('#livewire-error'); // $browser->assertVisible('@hide'); // $browser->assertNotVisible('@show'); // }) ->tap($this->assertInitialState()) ->waitForLivewire(function (Browser $browser) { $browser->type('@nested-property-input', 'a'); $browser->waitFor('@target-top-level-property'); $browser->assertNotVisible('@targeting'); $browser->assertNotVisible('@targeting-both'); $browser->assertVisible('@target-top-level-property'); }) ; }); } public function test_different_display_properties_when_loading() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, CustomDisplayProperty::class) ->assertScript('getComputedStyle(document.querySelector(\'[dusk="default"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline-block"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="block"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="flex"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="table"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="grid"]\')).display', 'none') ->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline-flex"]\')).display', 'none') ->waitForLivewire(function ($b) { $b->click('@refresh'); $b->pause(50); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="default"]\')).display', 'inline-block'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline-block"]\')).display', 'inline-block'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline"]\')).display', 'inline'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="block"]\')).display', 'block'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="flex"]\')).display', 'flex'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="table"]\')).display', 'table'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="grid"]\')).display', 'grid'); $b->assertScript('getComputedStyle(document.querySelector(\'[dusk="inline-flex"]\')).display', 'inline-flex'); }) ; }); } public function test_different_delay_durations() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, ComponentWithLoadingDelays::class) ->assertNotVisible('@delay-none') ->assertNotVisible('@delay-shortest') ->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->assertNotVisible('@delay-shortest') ->assertVisible('@delay-none'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(51) ->assertNotVisible('@delay-shorter') ->assertVisible('@delay-shortest'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(101) ->assertNotVisible('@delay-short') ->assertVisible('@delay-shorter'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(151) ->assertNotVisible('@delay') ->assertNotVisible('@delay-default') ->assertVisible('@delay-short'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(201) ->assertNotVisible('@delay-long') ->assertVisible('@delay') ->assertVisible('@delay-default'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(301) ->assertNotVisible('@delay-longer') ->assertVisible('@delay-long'); })->waitForLivewire(function (Browser $browser) { $browser->click('@load') ->pause(501) ->assertNotVisible('@delay-longest') ->assertVisible('@delay-longer'); }); // @todo: this is flaky... // })->waitForLivewire(function (Browser $browser) { // $browser->click('@load') // ->pause(1002) // ->assertVisible('@delay-longest'); // }); }); } protected function assertInitialState() { return function (Browser $browser) { $browser->assertNotVisible('@show'); $browser->assertVisible('@hide'); $browser->assertNotVisible('@show-w-delay'); $browser->assertAttribute('@add-class', 'class', ''); $browser->assertAttribute('@remove-class', 'class', 'foo'); $browser->assertAttributeMissing('@add-attr', 'disabled'); $browser->assertAttribute('@remove-attr', 'disabled', 'true'); $browser->assertClassMissing('@add-both', 'foo'); $browser->assertHasClass('@remove-both', 'foo'); $browser->assertAttributeMissing('@add-both', 'disabled'); $browser->assertAttribute('@remove-both', 'disabled', 'true'); $browser->assertNotVisible('@targeting'); $browser->assertNotVisible('@targeting-both'); $browser->assertNotVisible('@targeting-param'); $browser->assertNotVisible('@targeting-js-param'); $browser->assertNotVisible('@targeting-js-object-param'); $browser->assertNotVisible('@targeting-js-wrong-object-param'); $browser->assertClassMissing('@self-target-button', 'foo'); $browser->assertClassMissing('@self-target-model', 'foo'); }; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/ComponentWithLoadingDelays.php
legacy_tests/Browser/Loading/ComponentWithLoadingDelays.php
<?php namespace LegacyTests\Browser\Loading; use Livewire\Component as BaseComponent; class ComponentWithLoadingDelays extends BaseComponent { public $baz = ''; public function hydrate() { // Sleep for up to 1100ms as longest is 1000ms usleep(1000 * 1100); } public function render() { return <<< 'HTML' <div> <button wire:click="$refresh" dusk="load">Load</button> <h1 wire:loading.delay.none dusk="delay-none">Loading delay none</h1> <h1 wire:loading.delay.shortest dusk="delay-shortest">Loading delay shortest</h1> <h1 wire:loading.delay.shorter dusk="delay-shorter">Loading delay shorter</h1> <h1 wire:loading.delay.short dusk="delay-short">Loading delay short</h1> <h1 wire:loading.delay.default dusk="delay-default">Loading delay default</h1> <h1 wire:loading.delay dusk="delay">Loading delay</h1> <h1 wire:loading.delay.long dusk="delay-long">Loading delay long</h1> <h1 wire:loading.delay.longer dusk="delay-longer">Loading delay longer</h1> <h1 wire:loading.delay.longest dusk="delay-longest">Loading delay longest</h1> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/DataLoadingTest.php
legacy_tests/Browser/Loading/DataLoadingTest.php
<?php namespace LegacyTests\Browser\Loading; use Livewire\Component; use Livewire\Livewire; use Tests\BrowserTestCase; class DataLoadingTest extends BrowserTestCase { public function test_wire_submit_applies_data_loading_to_submit_button() { Livewire::visit(new class extends Component { public $title = ''; public function save() { sleep(1); } public function render() { return <<<'HTML' <div> <form wire:submit="save" dusk="form"> <input wire:model="title" type="text" dusk="input"> <button type="submit" dusk="submit">Save</button> </form> </div> HTML; } }) // Initially, neither form nor button should have data-loading ->assertAttributeMissing('@form', 'data-loading') ->assertAttributeMissing('@submit', 'data-loading') // Click submit and verify data-loading is applied to button, not form ->waitForLivewire(function ($browser) { $browser->click('@submit') ->pause(50) ->assertAttributeMissing('@form', 'data-loading') ->assertAttribute('@submit', 'data-loading', 'true'); }) // After request completes, data-loading should be removed ->assertAttributeMissing('@form', 'data-loading') ->assertAttributeMissing('@submit', 'data-loading') ; } public function test_wire_submit_with_enter_key_applies_data_loading_to_submit_button() { Livewire::visit(new class extends Component { public $title = ''; public function save() { sleep(1); } public function render() { return <<<'HTML' <div> <form wire:submit="save" dusk="form"> <input wire:model="title" type="text" dusk="input"> <button type="submit" dusk="submit">Save</button> </form> </div> HTML; } }) ->assertAttributeMissing('@submit', 'data-loading') // Press Enter in input field ->waitForLivewire(function ($browser) { $browser->type('@input', 'test') ->keys('@input', '{enter}') ->pause(50) ->assertAttribute('@submit', 'data-loading', 'true'); }) ->assertAttributeMissing('@submit', 'data-loading') ; } public function test_wire_submit_with_multiple_submit_buttons() { Livewire::visit(new class extends Component { public $action = ''; public function save() { $this->action = 'save'; sleep(1); } public function draft() { $this->action = 'draft'; sleep(1); } public function render() { return <<<'HTML' <div> <form wire:submit="save" dusk="form"> <input wire:model="action" type="text" dusk="input"> <button type="submit" dusk="save-button">Save</button> <button type="submit" wire:click.prevent="draft" dusk="draft-button">Draft</button> </form> </div> HTML; } }) // Click draft button - only that button should get data-loading ->waitForLivewire(function ($browser) { $browser->click('@draft-button') ->pause(50) ->assertAttributeMissing('@save-button', 'data-loading') ->assertAttribute('@draft-button', 'data-loading', 'true'); }) // Click save button - only that button should get data-loading ->waitForLivewire(function ($browser) { $browser->click('@save-button') ->pause(50) ->assertAttribute('@save-button', 'data-loading', 'true') ->assertAttributeMissing('@draft-button', 'data-loading'); }) ; } public function test_wire_click_still_applies_data_loading_to_clicked_element() { Livewire::visit(new class extends Component { public function doSomething() { sleep(1); } public function render() { return <<<'HTML' <div> <button wire:click="doSomething" dusk="button">Click me</button> </div> HTML; } }) ->assertAttributeMissing('@button', 'data-loading') ->waitForLivewire(function ($browser) { $browser->click('@button') ->pause(50) ->assertAttribute('@button', 'data-loading', 'true'); }) ->assertAttributeMissing('@button', 'data-loading') ; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/view.blade.php
legacy_tests/Browser/Loading/view.blade.php
<div> <button wire:click="$refresh" dusk="button">Load</button> <button wire:click="throwError" dusk="error-button">Throw Error</button> <h1 wire:loading dusk="show">Loading...</h1> <h1 wire:loading.remove dusk="hide">Loading...</h1> <h1 wire:loading.class="foo bar" dusk="add-class">Loading...</h1> <h1 wire:loading.class.remove="foo" dusk="remove-class" class="foo">Loading...</h1> <h1 wire:loading.attr="disabled" dusk="add-attr">Loading...</h1> <h1 wire:loading.attr.remove="disabled" dusk="remove-attr" disabled>Loading...</h1> <h1 wire:loading.class="foo" wire:loading.attr="disabled" dusk="add-both">Loading...</h1> <h1 wire:loading.class.remove="foo" wire:loading.attr.remove="disabled" dusk="remove-both" disabled class="foo">Loading...</h1> <h1 wire:loading wire:target="foo" dusk="targeting">Loading...</h1> <h1 wire:loading wire:target="foo, bar" dusk="targeting-both">Loading...</h1> <h1 wire:loading wire:target="foo('bar')" dusk="targeting-param">Param Loading...</h1> <h1 wire:loading wire:target="foo(@js('bar'))" dusk="targeting-js-param">Param Loading...</h1> <h1 wire:loading wire:target="foo(@js(['bar' => 'baz']))" dusk="targeting-js-object-param">Param Loading...</h1> <h1 wire:loading wire:target="foo(@js(['baz' => 'bar']))" dusk="targeting-js-wrong-object-param">Param Loading...</h1> <h1 wire:loading.delay dusk="show-w-delay">Loading with delay...</h1> <button wire:click="foo" dusk="target-button">targeted button</button> <button wire:click="foo('bar')" dusk="target-button-w-param">targeted button with param</button> <button wire:click="foo(@js(['bar' => 'baz']))" dusk="target-button-w-js-object-param">targeted button with JS object param</button> <button wire:click="bar" wire:loading.class="foo" dusk="self-target-button">self-targeted button</button> <input type="checkbox" wire:model.live="baz" wire:loading.class="foo" dusk="self-target-model">self-targeted-model input</input> <h1 wire:loading wire:target='bob' dusk="target-top-level-property">Loading with top level property target</h1> <input type="name" wire:model.live='bob.name' dusk="nested-property-input" />Nested property input </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Loading/Component.php
legacy_tests/Browser/Loading/Component.php
<?php namespace LegacyTests\Browser\Loading; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $baz = ''; public $bob = ['name' => '']; public function hydrate() { usleep(1000 * 250); } public function throwError() { throw new \Exception; } public function foo() {} public function bar() {} public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Morphdom/Test.php
legacy_tests/Browser/Morphdom/Test.php
<?php namespace LegacyTests\Browser\Morphdom; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: not settled on V3 hooks yet... $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * element root is DOM diffed */ ->assertAttributeMissing('@root', 'foo') ->waitForLivewire()->click('@foo') ->assertAttribute('@root', 'foo', 'true') /** * element inserted in the middle moves subsequent elements instead of removing them */ ->tap(function ($b) { $b->script([ 'window.elementWasRemoved = false', "Livewire.hook('element.removed', () => { window.elementWasRemoved = true })", ]);}) ->waitForLivewire()->click('@bar') ->assertScript('window.elementWasRemoved', false) /** * element inserted before element with same tag name is handled as if they were different. */ ->tap(function ($b) { $b->script([ 'window.lastAddedElement = false', "Livewire.hook('element.init', ({ el )} => { window.lastAddedElement = el })", ]);}) ->waitForLivewire()->click('@baz') ->assertScript('window.lastAddedElement.innerText', 'second') /** * elements added with keys are recognized in the custom lookahead */ ->waitForLivewire()->click('@bob') ->assertScript('Livewire.components.components()[0].morphChanges.added.length', 1) ->assertScript('Livewire.components.components()[0].morphChanges.removed.length', 0) ->tap(function ($b) { $b->script([ 'window.lastAddedElement = false', 'window.lastUpdatedElement = false', "Livewire.hook('element.updated', el => { window.lastUpdatedElement = el })", ]);}) ->waitForLivewire()->click('@qux') ->assertScript('window.lastAddedElement.innerText', 'second') ->assertScript('window.lastUpdatedElement.innerText', 'third') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Morphdom/view.blade.php
legacy_tests/Browser/Morphdom/view.blade.php
<div @if ($foo) foo="true" @endif dusk="root"> <button wire:click="$set('foo', true)" dusk="foo"></button> <button wire:click="$set('bar', true)" dusk="bar"> <div dusk="bar.start">start</div> @if ($bar) <div dusk="bar.middle">middle</div> @endif <div dusk="bar.end">end</div> </button> <button wire:click="$set('baz', true)" dusk="baz"> @if ($baz) <div>second</div> @endif <div>first</div> </button> <button wire:click="$set('bob', true)" dusk="bob"> @if ($bob) <div>0</div> @endif <div wire:key="bob">1</div> <div> <div id="bob-id">2</div> </div> </button> <button wire:click="$set('qux', true)" dusk="qux"> @if ($qux) <div>first</div> @endif <div> <div>second</div> <div wire:key="qux" data-qux="{{ $qux ? 'true' : 'false' }}">third</div> </div> </button> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Morphdom/Component.php
legacy_tests/Browser/Morphdom/Component.php
<?php namespace LegacyTests\Browser\Morphdom; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $foo = false; public $bar = false; public $baz = false; public $bob = false; public $lob = false; public $law = false; public $qux = false; public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/ProductionTest/Test.php
legacy_tests/Browser/ProductionTest/Test.php
<?php namespace LegacyTests\Browser\ProductionTest; use Livewire\Component; use Livewire\Livewire; use Tests\BrowserTestCase; class Test extends BrowserTestCase { public function test_ensure_livewire_runs_when_app_debug_is_set_to_false(): void { Livewire::visit(new class extends Component { public $foo = 'squishy'; public function mount() { config()->set('app.debug', false); } public function render() { return <<< 'HTML' <div> <input type="text" wire:model="foo" dusk="foo"> </div> HTML; } }) /** * Just need to check input is filled to ensure Livewire has started properly. * Have set app.debug to false inside mount method in component */ ->assertInputValue('@foo', 'squishy') ; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Nesting/NestedComponent.php
legacy_tests/Browser/Nesting/NestedComponent.php
<?php namespace LegacyTests\Browser\Nesting; use Livewire\Component as BaseComponent; class NestedComponent extends BaseComponent { public $output = ''; public function render() { return <<<'HTML' <div> <button wire:click="$set('output', 'foo')" dusk="button.nested"></button> <span dusk="output.nested">{{ $output }}</span> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Nesting/Test.php
legacy_tests/Browser/Nesting/Test.php
<?php namespace LegacyTests\Browser\Nesting; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, [Component::class, 'nested' => NestedComponent::class], '?showChild=true') /** * click inside nested component is assigned to nested component */ ->waitForLivewire()->click('@button.nested') ->assertSeeIn('@output.nested', 'foo') ->waitForLivewire()->click('@button.toggleChild') ->refresh()->pause(500) /** * added component gets initialized */ ->waitForLivewire()->click('@button.toggleChild') ->waitForLivewire()->click('@button.nested') ->assertSeeIn('@output.nested', 'foo') /** * can switch components */ ->waitForLivewire()->click('@button.changeKey') ->assertDontSeeIn('@output.nested', 'foo') ->waitForLivewire()->click('@button.nested') ->assertSeeIn('@output.nested', 'foo') ; }); } public function test_it_returns_the_render_context_back_to_the_parent_component_after_sub_component_is_rendered() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, [RenderContextComponent::class, 'nested' => NestedComponent::class]) ->assertSeeIn('@output.blade-component1', 'Blade 1') ->assertSeeIn('@output.blade-component2', 'Blade 2') ->assertSeeIn('@output.nested', 'Sub render') ->assertSeeIn('@output.blade-component3', 'Blade 3') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Nesting/RenderContextComponent.php
legacy_tests/Browser/Nesting/RenderContextComponent.php
<?php namespace LegacyTests\Browser\Nesting; use Livewire\Component as BaseComponent; class RenderContextComponent extends BaseComponent { public $one = 'Blade 1'; public $two = 'Blade 2'; public $three = 'Blade 3'; public function render() { return <<< 'HTML' <div> <x-blade-component dusk="output.blade-component1" property="one" /> <x-blade-component dusk="output.blade-component2" property="two" /> <div> @livewire('nested', ['output' => 'Sub render']) </div> <x-blade-component dusk="output.blade-component3" property="three" /> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Nesting/Component.php
legacy_tests/Browser/Nesting/Component.php
<?php namespace LegacyTests\Browser\Nesting; use Livewire\Component as BaseComponent; class Component extends BaseComponent { protected $queryString = ['showChild']; public $showChild = false; public $key = 'foo'; public function render() { return <<<'HTML' <div> <button wire:click="$toggle('showChild')" dusk="button.toggleChild"></button> <button wire:click="$set('key', 'bar')" dusk="button.changeKey"></button> @if ($showChild) @livewire('nested', key($key)) @endif </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/turbo.blade.php
legacy_tests/Browser/views/turbo.blade.php
<x-layouts.app-for-turbo-views> <h1 dusk="page.title">Testing Entangle with Turbo</h1> <a dusk="turbo.link" href="{{ $link }}">Go to Livewire Component</a> </x-layouts.app-for-turbo-views>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/components/blade-component.blade.php
legacy_tests/Browser/views/components/blade-component.blade.php
@props(['property']) <div {{ $attributes }}> {{ $this->getPropertyValue($property) }} </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/components/stack-child.blade.php
legacy_tests/Browser/views/components/stack-child.blade.php
@once @push('scripts') <script>window.stack_output.push('child-blade-scripts')</script> @endpush @endonce @push('scripts') <script>window.stack_output.push('child-blade-scripts-no-once')</script> @endpush
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/components/layouts/app-for-turbo-views.blade.php
legacy_tests/Browser/views/components/layouts/app-for-turbo-views.blade.php
<html> <head> @livewireStyles <meta name="csrf-token" content="{{ csrf_token() }}"> </head> <body> {{ $slot }} @livewireScripts <script type="module"> import hotwiredTurbo from 'https://cdn.skypack.dev/@hotwired/turbo'; </script> <script src="https://cdn.jsdelivr.net/gh/livewire/turbolinks@v0.1.4/dist/livewire-turbolinks.js" data-turbolinks-eval="false" data-turbo-eval="false"></script> <script data-turbo-eval="false"> document.addEventListener('turbo:before-render', () => { let permanents = document.querySelectorAll('[data-turbo-permanent]') let undos = Array.from(permanents).map(el => { el._x_ignore = true return () => { delete el._x_ignore } }) document.addEventListener('turbo:render', function handler() { while(undos.length) undos.shift()() document.removeEventListener('turbo:render', handler) }) }) </script> @stack('scripts') </body> </html>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/components/layouts/app.blade.php
legacy_tests/Browser/views/components/layouts/app.blade.php
<html> <head> <meta name="csrf-token" content="{{ csrf_token() }}"> </head> <body> {{ $slot }} @stack('scripts') </body> </html>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/layouts/app-for-normal-views.blade.php
legacy_tests/Browser/views/layouts/app-for-normal-views.blade.php
<html> <head> <meta name="csrf-token" content="{{ csrf_token() }}"> </head> <body> @yield('content') @stack('scripts') </body> </html>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/views/layouts/app.blade.php
legacy_tests/Browser/views/layouts/app.blade.php
<html> <head> <meta name="csrf-token" content="{{ csrf_token() }}"> </head> <body> {{ $slot }} @stack('scripts') </body> </html>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/ScriptTag/Test.php
legacy_tests/Browser/ScriptTag/Test.php
<?php namespace LegacyTests\Browser\ScriptTag; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: should we support this in V3? $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) ->assertScript('window.scriptTagWasCalled === undefined') ->waitForLivewire()->click('@button') ->assertScript('window.scriptTagWasCalled === true') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/ScriptTag/view.blade.php
legacy_tests/Browser/ScriptTag/view.blade.php
<div> <button wire:click="show" dusk="button"></button> @if($withScript) <script>window.scriptTagWasCalled = true</script> @endif </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/ScriptTag/Component.php
legacy_tests/Browser/ScriptTag/Component.php
<?php namespace LegacyTests\Browser\ScriptTag; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $withScript = false; public function show() { $this->withScript = true; } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Headers/Test.php
legacy_tests/Browser/Headers/Test.php
<?php namespace LegacyTests\Browser\Headers; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: Caleb needs to think more deeply about JS hooks for V3... $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * Basic action (click). */ ->waitForLivewire()->click('@foo') ->assertSeeIn('@output', 'Bar') ->assertSeeIn('@altoutput', 'Bazz') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Headers/view.blade.php
legacy_tests/Browser/Headers/view.blade.php
<div> <button type="button" wire:click="setOutputToFooHeader" dusk="foo">Foo</button> <p> <span dusk="output">{{ $output }}</span> </p> <p> <span dusk="altoutput">{{ $altoutput }}</span> </p> </div> @push('scripts') <script type="text/javascript"> document.addEventListener("livewire:load", function(event) { window.livewire.addHeaders({ 'X-Foo-Header': 'Bar' }); window.livewire.addHeaders({ 'X-Bazz-Header': 'Bazz' }); }); </script> @endpush
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Headers/Component.php
legacy_tests/Browser/Headers/Component.php
<?php namespace LegacyTests\Browser\Headers; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $output = ''; public $altoutput = ''; public function setOutputToFooHeader() { $this->output = request()->header('x-foo-header', ''); $this->altoutput = request()->header('x-bazz-header', ''); } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Stacks/Test.php
legacy_tests/Browser/Stacks/Test.php
<?php namespace LegacyTests\Browser\Stacks; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test_conditionally_loaded_component_can_push_and_preppend_to_stack() { $this->markTestSkipped('Stacks feature reverted since 2021-10-20'); $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', ])) ->waitForLivewire()->click('@toggle-child') ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', 'child-scripts', ])) ->waitForLivewire()->click('@toggle-child') ->waitForLivewire()->click('@toggle-child') ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', 'child-scripts', ])) ->waitForLivewire()->click('@refresh-parent') ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', 'child-scripts', ])) ->waitForLivewire()->click('@toggle-blade-child') ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', 'child-scripts', 'child-blade-scripts', 'child-blade-scripts-no-once', 'child-blade-scripts-no-once', ])) ->waitForLivewire()->click('@toggle-blade-child') ->waitForLivewire()->click('@toggle-blade-child') ->waitForLivewire()->click('@refresh-child') ->assertScript('JSON.stringify(window.stack_output)', json_encode([ 'parent-scripts', 'child-scripts', 'child-blade-scripts', 'child-blade-scripts-no-once', 'child-blade-scripts-no-once', ])) ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Stacks/ChildComponent.php
legacy_tests/Browser/Stacks/ChildComponent.php
<?php namespace LegacyTests\Browser\Stacks; use Livewire\Component as BaseComponent; class ChildComponent extends BaseComponent { public $show = false; public function render() { return <<<'HTML' <div> The Child component <button wire:click="$toggle('show')" dusk="toggle-blade-child">Toggle Blade Component</button> <button wire:click="$refresh" dusk="refresh-child">Refresh</button> @if ($show) <x-stack-child /> <x-stack-child /> @endif </div> @once @push('scripts') <script>window.stack_output.push('child-scripts')</script> @endpush @endonce HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Stacks/Component.php
legacy_tests/Browser/Stacks/Component.php
<?php namespace LegacyTests\Browser\Stacks; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $show = false; public function render() { return <<<'HTML' <div> <button wire:click="$toggle('show')" dusk="toggle-child">Toggle Child</button> <button wire:click="$refresh" dusk="refresh-parent">Refresh</button> <script>window.stack_output = []</script> @if ($show) @livewire(\Tests\Browser\Stacks\ChildComponent::class) @endif </div> @once @push('styles') <script>window.stack_output.push('parent-styles')</script> @endpush @endonce @once @prepend('scripts') <script>window.stack_output.push('parent-scripts')</script> @endprepend @endonce HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Prefetch/Test.php
legacy_tests/Browser/Prefetch/Test.php
<?php namespace LegacyTests\Browser\Prefetch; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: Considering leaving this feature out of V3 at least initially. Not many use it... $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) ->assertSeeIn('@count', '1') ->mouseover('@button') ->pause(250) // We have to pause because prefetching doesn't call normal response hooks. ->assertSeeIn('@count', '1') ->click('@button') ->assertSeeIn('@count', '2'); }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Prefetch/view.blade.php
legacy_tests/Browser/Prefetch/view.blade.php
<div> <button wire:click.prefetch="$refresh" dusk="button">inc</button> <span dusk="count">{{ app('session')->get('count') }}</span> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Prefetch/Component.php
legacy_tests/Browser/Prefetch/Component.php
<?php namespace LegacyTests\Browser\Prefetch; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public function render() { app('session')->put('count', app('session')->get('count') + 1); return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/MagicActions/Test.php
legacy_tests/Browser/MagicActions/Test.php
<?php namespace LegacyTests\Browser\MagicActions; use Livewire\Livewire; use Tests\BrowserTestCase; class Test extends BrowserTestCase { public function test_magic_toggle_can_toggle_properties() { Livewire::visit(Component::class) //Toggle boolean property ->assertSeeIn('@output', 'false') ->waitForLivewire()->click('@toggle') ->assertSeeIn('@output', 'true') ->waitForLivewire()->click('@toggle') ->assertSeeIn('@output', 'false') //Toggle nested boolean property ->assertSeeIn('@outputNested', 'false') ->waitForLivewire()->click('@toggleNested') ->assertSeeIn('@outputNested', 'true') ->waitForLivewire()->click('@toggleNested') ->assertSeeIn('@outputNested', 'false') ; } public function test_magic_event_works() { Livewire::visit(Component::class) ->assertDontSeeIn('@outputEvent', 'baz') ->waitForLivewire()->click('@fillBar') ->assertSeeIn('@outputEvent', 'baz') ; } } class Component extends \Livewire\Component { public $active = false; public $foo = ['bar' => ['baz' => false]]; public $bar = ''; public function setBar($bar) { $this->bar = $bar; } public function render() { return <<<'HTML' <div> <div dusk="output">{{ $active ? "true" : "false" }}</div> <button wire:click="$toggle('active')" dusk="toggle">Toggle Property</button> <div dusk="outputNested">{{ $foo['bar']['baz'] ? "true" : "false" }}</div> <button wire:click="$toggle('foo.bar.baz')" dusk="toggleNested">Toggle Nested</button> <div dusk="outputEvent">{{ $bar }}</div> <div wire:click="setBar($event.target.id)" id="baz" dusk="fillBar">Click me</div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Hooks/Test.php
legacy_tests/Browser/Hooks/Test.php
<?php namespace LegacyTests\Browser\Hooks; use Laravel\Dusk\Browser; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->markTestSkipped(); // @todo: Caleb needs to think more deeply about JS hooks for V3... $this->browse(function (Browser $browser) { $this->visitLivewireComponent($browser, Component::class) ->tap(function ($b) { $b->script([ "window.livewire.hook('message.received', () => { document.querySelector('[dusk=\"output\"]').value = 'before'; })", "window.livewire.hook('message.processed', () => { document.querySelector('[dusk=\"output\"]').value += '_after'; })", ]); }) ->tap(function ($b) { $this->assertEquals('', $b->value('@output')); }) ->waitForLivewire()->click('@button') ->tap(function ($b) { $this->assertEquals('before_after', $b->value('@output')); }) ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Hooks/view.blade.php
legacy_tests/Browser/Hooks/view.blade.php
<div> <button wire:click="showFoo" dusk="button">show</button> <input dusk="output" /> @if($foo) <div dusk="foo"></div> @endif </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Hooks/Component.php
legacy_tests/Browser/Hooks/Component.php
<?php namespace LegacyTests\Browser\Hooks; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $foo = false; public function showFoo() { $this->foo = true; } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/FileDownloads/Test.php
legacy_tests/Browser/FileDownloads/Test.php
<?php namespace LegacyTests\Browser\FileDownloads; use LegacyTests\Browser\TestCase; use Illuminate\Support\Facades\Storage; use Livewire\Component; class Test extends TestCase { public function test_trigger_downloads_from_livewire_component() { $this->onlyRunOnChrome(); $this->browse(function ($browser) { $this->visitLivewireComponent($browser, DownloadComponent::class) ->waitForLivewire()->click('@download') ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download-target.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download-target.txt') ); $this->visitLivewireComponent($browser, DownloadComponent::class) ->waitForLivewire()->click('@download-quoted-disposition-filename') ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download & target.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download & target.txt') ); /** * Trigger download with a response return. */ $this->visitLivewireComponent($browser, DownloadComponent::class) ->waitForLivewire()->click('@download-from-response') ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download-target2.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download-target2.txt') ); $this->visitLivewireComponent($browser, DownloadComponent::class) ->waitForLivewire()->click('@download-from-response-quoted-disposition-filename') ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download & target2.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download & target2.txt') ); }); } public function test_trigger_downloads_from_livewire_component_with_headers() { $this->onlyRunOnChrome(); $this->browse(function ($browser) { // Download with content-type header. $this->visitLivewireComponent($browser, DownloadComponent::class) ->tap(function ($b) { $b->script([ "window.Livewire.hook('commit', ({ component, succeed }) => { succeed(({ effects }) => { document.querySelector('[dusk=\"content-type\"]').value = effects.download.contentType; }) })", ]); }) ->waitForLivewire()->click('@download-with-content-type-header') ->tap(function ($b) { $this->assertEquals('text/html', $b->value('@content-type')); }) ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download-target.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download-target.txt') ); // Skipping this assertion for now because it fails in CI, showing "text/plain" instead of null... // Download with null content-type header. // $this->visitLivewireComponent($browser, DownloadComponent::class) // ->tap(function ($b) { // $b->script([ // "window.Livewire.hook('commit', ({ component, succeed }) => { // succeed(({ effects }) => { // document.querySelector('[dusk=\"content-type\"]').value = effects.download.contentType; // }) // })", // ]); // }) // ->waitForLivewire()->click('@download-with-null-content-type-header') // ->tap(function ($b) { // $this->assertEquals(null, $b->value('@content-type')); // }) // ->waitUsing(5, 75, function () { // return Storage::disk('dusk-downloads')->exists('download-target.txt'); // }); // $this->assertStringContainsString( // 'I\'m the file you should download.', // Storage::disk('dusk-downloads')->get('download-target.txt') // ); /** * Download an untitled file with "invalid" content-type header. * It mimics this test: dusk="download-an-untitled-file-with-content-type-header" */ $this->visitLivewireComponent($browser, DownloadComponent::class) ->tap(function ($b) { $b->script([ "window.Livewire.hook('commit', ({ component, succeed }) => { succeed(({ effects }) => { document.querySelector('[dusk=\"content-type\"]').value = effects.download.contentType; }) })", ]); }) ->waitForLivewire()->click('@download-an-untitled-file-with-invalid-content-type-header') ->tap(function ($b) { $this->assertEquals('foo', $b->value('@content-type')); }) ->waitUsing(5, 75, function () { // Normally it should have been __.html --But the content type is invalid... return Storage::disk('dusk-downloads')->exists('__.txt'); }); // ...But the file is still readable. $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('__.txt') ); // Download an untitled file with content-type header. $this->visitLivewireComponent($browser, DownloadComponent::class) ->tap(function ($b) { $b->script([ "window.Livewire.hook('commit', ({ component, succeed }) => { succeed(({ effects }) => { document.querySelector('[dusk=\"content-type\"]').value = effects.download.contentType; }) })", ]); }) ->waitForLivewire()->click('@download-an-untitled-file-with-content-type-header') ->tap(function ($b) { $this->assertEquals('text/html', $b->value('@content-type')); }) ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('__.html'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('__.html') ); /** * Trigger download with a response return. */ $this->visitLivewireComponent($browser, DownloadComponent::class) ->tap(function ($b) { $b->script([ "window.Livewire.hook('commit', ({ component, succeed }) => { succeed(({ effects }) => { document.querySelector('[dusk=\"content-type\"]').value = effects.download.contentType; }) })", ]); }) ->waitForLivewire()->click('@download-from-response-with-content-type-header') ->tap(function ($b) { $this->assertEquals('text/csv', $b->value('@content-type')); }) ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download-target2.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download-target2.txt') ); }); } public function test_trigger_downloads_from_event_listener() { $this->onlyRunOnChrome(); $this->browse(function ($browser) { $this->visitLivewireComponent($browser, DownloadComponent::class) ->waitForLivewire()->click('@dispatch-download') ->waitUsing(5, 75, function () { return Storage::disk('dusk-downloads')->exists('download-target.txt'); }); $this->assertStringContainsString( 'I\'m the file you should download.', Storage::disk('dusk-downloads')->get('download-target.txt') ); }); } } class DownloadComponent extends Component { protected $listeners = [ 'download' ]; public function download() { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return Storage::disk('dusk-tmp')->download('download-target.txt'); } public function downloadWithContentTypeHeader($contentType = null) { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return Storage::disk('dusk-tmp')->download('download-target.txt', null, ['Content-Type' => $contentType]); } public function downloadAnUntitledFileWithContentTypeHeader($contentType = 'text/html') { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return Storage::disk('dusk-tmp')->download('download-target.txt', '', ['Content-Type' => $contentType]); } public function downloadFromResponse() { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return response()->download( Storage::disk('dusk-tmp')->path('download-target2.txt') ); } public function downloadFromResponseWithContentTypeHeader() { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return response()->download( Storage::disk('dusk-tmp')->path('download-target2.txt'), 'download-target2.txt', ['Content-Type' => 'text/csv'] ); } public function downloadQuotedContentDispositionFilename() { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return Storage::disk('dusk-tmp')->download('download & target.txt'); } public function downloadQuotedContentDispositionFilenameFromResponse() { config()->set('filesystems.disks.dusk-tmp', [ 'driver' => 'local', 'root' => __DIR__, ]); return response()->download( Storage::disk('dusk-tmp')->path('download & target2.txt') ); } public function render() { return <<<'HTML' <div> <button wire:click="$dispatch('download')" dusk="dispatch-download">Dispatch Download</button> <button wire:click="download" dusk="download">Download</button> <button wire:click="downloadFromResponse" dusk="download-from-response">Download</button> <button wire:click="downloadQuotedContentDispositionFilename" dusk="download-quoted-disposition-filename">Download</button> <button wire:click="downloadQuotedContentDispositionFilenameFromResponse" dusk="download-from-response-quoted-disposition-filename">Download</button> <button wire:click="downloadWithContentTypeHeader('text/html')" dusk="download-with-content-type-header">Download</button> <button wire:click="downloadWithContentTypeHeader()" dusk="download-with-null-content-type-header">Download</button> <button wire:click="downloadAnUntitledFileWithContentTypeHeader" dusk="download-an-untitled-file-with-content-type-header">Download</button> <button wire:click="downloadAnUntitledFileWithContentTypeHeader('foo')" dusk="download-an-untitled-file-with-invalid-content-type-header">Download</button> <button wire:click="downloadFromResponseWithContentTypeHeader" dusk="download-from-response-with-content-type-header">Download</button> <input dusk="content-type" /> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/SmallComponent.php
legacy_tests/Browser/Alpine/SmallComponent.php
<?php namespace LegacyTests\Browser\Alpine; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class SmallComponent extends BaseComponent { public $count = 0; public function increment() { $this->count++; } public function render() { return View::file(__DIR__.'/small-component.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/SimultaneousCallsComponent.php
legacy_tests/Browser/Alpine/SimultaneousCallsComponent.php
<?php namespace LegacyTests\Browser\Alpine; use Livewire\Component as BaseComponent; class SimultaneousCallsComponent extends BaseComponent { public function returnValue($value) { return $value; } public function render() { return <<<'HTML' <div> <div x-data="{ foo: '...', bar: '...' }"> <div x-on:click="bar = await $wire.returnValue('bar')"> <div x-on:click="foo = await $wire.returnValue('foo')"> <button dusk="update-foo-and-bar">Update foo and bar at the same time:</button> </div> </div> foo: <span x-text="foo" dusk="foo"></span> bar: <span x-text="bar" dusk="bar"></span> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Test.php
legacy_tests/Browser/Alpine/Test.php
<?php namespace LegacyTests\Browser\Alpine; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, Component::class) /** * ->dispatchBrowserEvent() */ ->assertDontSeeIn('@foo.output', 'bar') ->waitForLivewire()->click('@foo.button') ->assertSeeIn('@foo.output', 'bar') /** * Basic counter Alpine component. */ ->assertSeeIn('@bar.output', '0') ->click('@bar.button') ->assertSeeIn('@bar.output', '1') ->waitForLivewire()->click('@bar.refresh') ->assertSeeIn('@bar.output', '1') /** * get, set, and call to Livewire from Alpine. */ ->assertSeeIn('@baz.output', '0') ->assertSeeIn('@baz.get', '0') ->assertSeeIn('@baz.get.proxy', '0') ->assertSeeIn('@baz.get.proxy.magic', '0') ->waitForLivewire()->click('@baz.set') ->assertSeeIn('@baz.output', '1') ->waitForLivewire()->click('@baz.set.proxy') ->assertSeeIn('@baz.output', '2') ->click('@baz.set.proxy.magic') ->waitForLivewire()->click('@baz.call') ->assertSeeIn('@baz.output', '4') ->waitForLivewire()->click('@baz.call.proxy') ->assertSeeIn('@baz.output', '5') ->waitForLivewire()->click('@baz.call.proxy.magic') ->assertSeeIn('@baz.output', '6') /** * get, set, and call with special characters */ ->assertSeeIn('@special.output', 'abc') ->assertSeeIn('@special.get', 'abc') ->assertSeeIn('@special.get.proxy', 'abc') ->assertSeeIn('@special.get.proxy.magic', 'abc') ->waitForLivewire()->click('@special.set') ->assertSeeIn('@special.output', 'ž') ->waitForLivewire()->click('@special.set.proxy') ->assertSeeIn('@special.output', 'žž') ->click('@special.set.proxy.magic') ->waitForLivewire()->click('@special.call') ->assertSeeIn('@special.output', 'žžžž') ->waitForLivewire()->click('@special.call.proxy') ->assertSeeIn('@special.output', 'žžžžž') ->waitForLivewire()->click('@special.call.proxy.magic') ->assertSeeIn('@special.output', 'žžžžžž') /** * .call() return value */ ->assertDontSeeIn('@bob.output', '1') ->waitForLivewire()->click('@bob.button.await') ->assertSeeIn('@bob.output', '1') ->waitForLivewire()->click('@bob.button.promise') ->assertSeeIn('@bob.output', '2') /** * $wire.entangle */ ->assertSeeIn('@lob.output', '6') ->waitForLivewire(function ($b) { $b->click('@lob.increment'); }) ->assertSeeIn('@lob.output', '7') ->click('@lob.decrement') ->assertSeeIn('@lob.output', '6') /** * $wire.entangle nested property */ ->assertSeeIn('@law.output.alpine', '0') ->assertSeeIn('@law.output.wire', '0') ->assertSeeIn('@law.output.blade', '0') ->waitForLivewire()->click('@law.increment.livewire') ->assertSeeIn('@law.output.alpine', '1') ->assertSeeIn('@law.output.wire', '1') ->assertSeeIn('@law.output.blade', '1') ->waitForLivewire()->click('@law.increment.alpine') ->assertSeeIn('@law.output.alpine', '2') ->assertSeeIn('@law.output.wire', '2') ->assertSeeIn('@law.output.blade', '2') /** * Make sure property change from Livewire doesn't trigger an additional * request because of @entangle. */ ->tap(function ($b) { $b->script([ 'window.livewireRequestCount = 0', "window.Livewire.hook('request', () => { window.livewireRequestCount++ })", ]); }) ->assertScript('window.livewireRequestCount', 0) ->waitForLivewire(function ($b) { $b->click('@lob.reset'); }) ->assertScript('window.livewireRequestCount', 1) ->pause(500) ->assertMissing('#livewire-error') ->assertSeeIn('@lob.output', '100') /** * $dispatch('input', value) works with wire:model */ ->assertSeeIn('@zorp.output', 'before') ->waitForLivewire()->click('@zorp.button') ->assertSeeIn('@zorp.output', 'after') ->waitForLivewire()->click('@zorp.button.empty') ->assertSeeNothingIn('@zorp.output') ; }); } public function test_alpine_still_updates_even_when_livewire_doesnt_update_html() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, SmallComponent::class) ->assertSeeIn('@output', '0') ->waitForLivewire()->click('@button') ->assertSeeIn('@output', '1') ; }); } public function test_morphdom_can_handle_adding_at_symbol_attributes() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, MorphingAtSymbolAttributeComponent::class) ->assertAttributeMissing('@span', '@click', 'hey') ->waitForLivewire()->click('@button') ->assertAttribute('@span', '@click', 'hey') ->waitForLivewire()->click('@button') ->assertAttributeMissing('@span', '@click', 'hey') ; }); } public function test_alpine_registers_click_handlers_properly_on_livewire_change() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, ClickComponent::class) ->waitForLivewire()->click('@show') ->click('@click') ->assertSeeIn('@alpineClicksFired', 1) ->click('@click') ->assertSeeIn('@alpineClicksFired', 2) ->click('@click') ->assertSeeIn('@alpineClicksFired', 3) ->click('@componentClick') ->assertSeeIn('@alpineComponentClicksFired', 1) ->click('@componentClick') ->assertSeeIn('@alpineComponentClicksFired', 2) ->click('@componentClick') ->assertSeeIn('@alpineComponentClicksFired', 3) ; }); } public function test_alpine_handles_responses_from_multiple_simultaneous_calls_to_livewire() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, SimultaneousCallsComponent::class) ->assertDontSeeIn('@foo', 'foo') ->assertDontSeeIn('@bar', 'bar') ->waitForLivewire()->click('@update-foo-and-bar') ->assertSeeIn('@foo', 'foo') ->assertSeeIn('@bar', 'bar') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/small-component.blade.php
legacy_tests/Browser/Alpine/small-component.blade.php
<div> <!-- It's important that this element has not server-side HTML side-effects so we can prove an empty HTML payload won't cause Alpine issues. --> <div x-data> <h1 x-text="$wire.count" dusk="output"></h1> <button x-on:click="$wire.increment()" dusk="button">$wire.increment()</button> </div> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/ClickComponent.php
legacy_tests/Browser/Alpine/ClickComponent.php
<?php namespace LegacyTests\Browser\Alpine; use Livewire\Component as BaseComponent; class ClickComponent extends BaseComponent { public $show = false; public function render() { return <<<'HTML' <div> <div x-data="{ clicks: [] }"> <button dusk="show" wire:click="$set('show', true)">Toggle Options</button> <div> @if ($show) <button dusk="click" x-on:click="clicks.push('Clicked')">Click</button> <button dusk="componentClick" x-data="{ componentClicks: [] }" x-on:click="componentClicks.push('Clicked')"> Component Click <div>Number of component clicks: <span dusk="alpineComponentClicksFired" x-text="componentClicks.length"></span></div> </button> @endif </div> <div>Number of clicks: <span dusk="alpineClicksFired" x-text="clicks.length"></span></div> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/MorphingAtSymbolAttributeComponent.php
legacy_tests/Browser/Alpine/MorphingAtSymbolAttributeComponent.php
<?php namespace LegacyTests\Browser\Alpine; use Livewire\Component as BaseComponent; class MorphingAtSymbolAttributeComponent extends BaseComponent { public $show = false; public function render() { return <<<'EOD' <div> <div x-data> <button wire:click="$toggle('show')" dusk="button">Toggle</button> <span @if($show) @@click="hey" @endif dusk="span">hey</span> </div> </div> EOD; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/view.blade.php
legacy_tests/Browser/Alpine/view.blade.php
<div> <div x-data="{ output: '' }" x-on:some-event.window="output = $event.detail.bar"> <span x-text="output" dusk="foo.output"></span> <button type="button" dusk="foo.button" wire:click="dispatchSomeEvent">Dispatch</button> </div> <div x-data="{ count: 0 }"> <span x-text="count" dusk="bar.output"></span> <button type="button" dusk="bar.button" x-on:click="count++">Inc</button> <button type="button" dusk="bar.refresh" wire:click="$refresh">Refresh</button> </div> <div x-data> <span dusk="baz.get" x-text="@this.get('count')"></span> <span dusk="baz.get.proxy" x-text="$wire.get('count')"></span> <span dusk="baz.get.proxy.magic" x-text="$wire.count"></span> <button type="button" dusk="baz.set" x-on:click="@this.set('count', 1)"></button> <button type="button" dusk="baz.set.proxy" x-on:click="$wire.set('count', 2)"></button> <button type="button" dusk="baz.set.proxy.magic" x-on:click="$wire.count++"></button> <button type="button" dusk="baz.call" x-on:click="@this.call('setCount', 4)"></button> <button type="button" dusk="baz.call.proxy" x-on:click="$wire.call('setCount', 5)"></button> <button type="button" dusk="baz.call.proxy.magic" x-on:click="$wire.setCount(6)"></button> <span dusk="baz.output">{{ $count }}</span> </div> {{-- Special characters are encoded properly --}} <div x-data> <span dusk="special.get" x-text="@this.get('special')"></span> <span dusk="special.get.proxy" x-text="$wire.get('special')"></span> <span dusk="special.get.proxy.magic" x-text="$wire.special"></span> <button type="button" dusk="special.set" x-on:click="@this.set('special', 'ž')"></button> <button type="button" dusk="special.set.proxy" x-on:click="$wire.set('special', 'žž')"></button> <button type="button" dusk="special.set.proxy.magic" x-on:click="$wire.special = 'žžž'"></button> <button type="button" dusk="special.call" x-on:click="@this.call('setSpecial', 'žžžž')"></button> <button type="button" dusk="special.call.proxy" x-on:click="$wire.call('setSpecial', 'žžžžž')"></button> <button type="button" dusk="special.call.proxy.magic" x-on:click="$wire.setSpecial('žžžžžž')"></button> <span dusk="special.output">{{ $special }}</span> </div> <div x-data="{ count: null }"> <button type="button" dusk="bob.button.await" x-on:click="count = await $wire.returnValue(1)"></button> <button type="button" dusk="bob.button.promise" x-on:click="$wire.returnValue(2).then(value => count = value)"></button> <span dusk="bob.output" x-text="count"></span> </div> {{-- Concatenating inside @entangle to make sure full PHP expressions work. --}} <div x-data="{ count: @entangle('co' . 'unt').live }"> <button wire:click="$set('count', 100)" dusk="lob.reset">Reset</button> <button type="button" dusk="lob.increment" x-on:click="count++"></button> <button type="button" dusk="lob.decrement" x-on:click="$wire.count--"></button> <span dusk="lob.output" x-text="$wire.count"></span> </div> <div x-data="{ count: @entangle('nested.count').live }"> <button wire:click="incrementNestedCount" dusk="law.increment.livewire">Livewire +</button> <button type="button" dusk="law.increment.alpine" x-on:click="count++">Alpine +</button> <span dusk="law.output.alpine" x-text="count"></span> <span dusk="law.output.wire" x-text="$wire.nested.count"></span> <span dusk="law.output.blade">{{ $nested['count'] }}"</span> </div> <div x-data wire:model.live="zorp"> <button type="button" @click="$dispatch('input', 'after')" dusk="zorp.button">Before -> After</button> <button @click="$dispatch('input', '')" dusk="zorp.button.empty" value="it should not fall back to this">Empty</button> <span dusk="zorp.output">{{ $zorp }}</span> </div> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Component.php
legacy_tests/Browser/Alpine/Component.php
<?php namespace LegacyTests\Browser\Alpine; use Illuminate\Support\Facades\View; use Livewire\Component as BaseComponent; class Component extends BaseComponent { public $count = 0; public $special = 'abc'; public $zorp = 'before'; public $nested = [ 'count' => 0, ]; public function incrementNestedCount() { $this->nested['count'] = $this->nested['count'] + 1; } public function setCount($value) { $this->count = $value; } public function setSpecial($value) { $this->special = $value; } public function dispatchSomeEvent() { $this->dispatch('some-event', bar: 'bar'); } public function returnValue($value) { return $value; } public function updatingCount() { if ($this->count === 100) throw new \Exception('"count" shouldnt already be "100". This means @entangle made an extra request after Livewire set the data.'); } public function render() { return View::file(__DIR__.'/view.blade.php'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Dispatch/DispatchComponent.php
legacy_tests/Browser/Alpine/Dispatch/DispatchComponent.php
<?php namespace LegacyTests\Browser\Alpine\Dispatch; use Livewire\Component as BaseComponent; class DispatchComponent extends BaseComponent { public $events = [ 'dispatch' => false, 'dispatchUp' => false, 'dispatchTo' => false, 'dispatchSelf' => false, ]; protected $listeners = ['dispatch' => 'dispatchHandler']; public function dispatchHandler($name) { $this->events[$name] = true; } public function render() { return <<<'HTML' <div> <div x-data> <button dusk="dispatch" @click="$wire.dispatch('dispatch', { name: 'dispatch' })">Dispatch</button> @if ($events['dispatch']) Dispatch worked! @endif </div> <div x-data> <button dusk="dispatchSelf" @click="$wire.dispatchSelf('dispatch', { name: 'dispatchSelf' })">Dispatch Self</button> @if ($events['dispatchSelf']) Dispatch self worked! @endif </div> @livewire(LegacyTests\Browser\Alpine\Dispatch\DispatchNestedComponent::class) @if ($events['dispatchUp']) Dispatch up worked! @endif @if ($events['dispatchTo']) Dispatch to worked! @endif </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Dispatch/Test.php
legacy_tests/Browser/Alpine/Dispatch/Test.php
<?php namespace LegacyTests\Browser\Alpine\Dispatch; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test_dollar_wire_dispatch_works() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, ['parent' => DispatchComponent::class, 'child' => DispatchNestedComponent::class]) ->assertDontSee('dispatch worked') ->waitForLivewire() ->click('@dispatch') ->assertSee('Dispatch worked') ->assertDontSee('Dispatch self worked') ->waitForLivewire() ->click('@dispatchSelf') ->assertSee('Dispatch self worked') ->assertDontSee('Dispatch to worked') ->waitForLivewire() ->click('@dispatchTo') ->assertSee('Dispatch to worked') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Dispatch/DispatchNestedComponent.php
legacy_tests/Browser/Alpine/Dispatch/DispatchNestedComponent.php
<?php namespace LegacyTests\Browser\Alpine\Dispatch; use Livewire\Component as BaseComponent; class DispatchNestedComponent extends BaseComponent { public function render() { return <<<'HTML' <div> <div x-data> <button dusk="dispatchTo" @click="$wire.dispatchTo('parent', 'dispatch', { name: 'dispatchTo' })">Dispatch To</button> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Directive/Test.php
legacy_tests/Browser/Alpine/Directive/Test.php
<?php namespace LegacyTests\Browser\Alpine\Directive; use LegacyTests\Browser\TestCase; /** @group morphing */ class Test extends TestCase { public function test_bind_x_data_after_livewire_commit() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, DirectiveComponent::class) ->waitForLivewire() ->click('@button') ->assertConsoleLogMissingWarning('value is not defined') ; }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Directive/DirectiveComponent.php
legacy_tests/Browser/Alpine/Directive/DirectiveComponent.php
<?php namespace LegacyTests\Browser\Alpine\Directive; use Livewire\Component as BaseComponent; class DirectiveComponent extends BaseComponent { public function render() { return <<<'HTML' <div> <div x-foo> <span x-text="value"></span> </div> <button dusk="button" wire:click="$refresh"> refresh </button> <script> document.addEventListener('alpine:init', () => { Alpine.directive('foo', function (el) { Alpine.bind(el, { 'x-data'() { return { value: false } }, 'x-on:click'() { this.value = !this.value; } }) }) }) </script> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/EntangleConsecutiveActions.php
legacy_tests/Browser/Alpine/Entangle/EntangleConsecutiveActions.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class EntangleConsecutiveActions extends BaseComponent { public $livewireList = []; public function add() { $this->livewireList[] = count($this->livewireList); } public function render() { return <<<'HTML' <div x-data="{ alpineList: @entangle('livewireList').live }"> <div>Alpine</div> <div dusk="alpineOutput"> <template x-for="(item, key) in alpineList" :key="key"> <div x-text="item"></div> </template> </div> <div>Livewire</div> <div dusk="livewireOutput"> @foreach($livewireList as $key => $item) <div>{{ $item }}</div> @endforeach </div> <div> <button dusk="alpineAdd" type="button" x-on:click="alpineList.push(alpineList.length)">Add Alpine</button> <button dusk="livewireAdd" type="button" wire:click="add">Add Livewire</button> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/DeferDataUpdates.php
legacy_tests/Browser/Alpine/Entangle/DeferDataUpdates.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class DeferDataUpdates extends BaseComponent { public $testing = null; public function render() { return <<<'HTML' <div x-data="{ testing: @entangle('testing') }"> <input type="text" x-model="testing" dusk="input"> <p>Alpine: <span dusk="output.alpine" x-text="testing"></span></p> <p>Livewire: <span dusk="output.livewire">{{$testing}}</span></p> <button wire:click.prevent="$refresh" dusk="submit">Submit</button> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/EntangleNestedChildComponent.php
legacy_tests/Browser/Alpine/Entangle/EntangleNestedChildComponent.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class EntangleNestedChildComponent extends BaseComponent { public $item; protected $rules = ['item.name' => '']; public function render() { return <<<'HTML' <div x-data="{ name: @entangle('item.name') }"> <div dusk="livewire-output-{{ $item['name']}}">{{ $item['name']}}</div> <div dusk="alpine-output-{{ $item['name']}}"><span x-text="name"></span></div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/ToggleEntangledTurbo.php
legacy_tests/Browser/Alpine/Entangle/ToggleEntangledTurbo.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class ToggleEntangledTurbo extends BaseComponent { public $active = false; public $title = 'Showing Livewire&Alpine Component after a Turbo Visit'; public function render() { return view()->file(__DIR__ . '/view-toggle-entangled-turbo.blade.php') ->layout('components.layouts.app-for-turbo-views'); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/DeferArrayDataUpdates.php
legacy_tests/Browser/Alpine/Entangle/DeferArrayDataUpdates.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class DeferArrayDataUpdates extends BaseComponent { public $testing; public $dataArray = ['role' => 'guest']; public function submit() { $this->reset('dataArray'); } public function render() { return <<<'HTML' <div x-data="{ alpineRole: @entangle('dataArray.role') }"> <select x-model="alpineRole" dusk="role-select"> <option value="guest">Guest</option> <option value="user">User</option> <option value="admin">Admin</option> </select> <p>Alpine: <span dusk="output.alpine" x-text="alpineRole"></span></p> <p>Livewire: <span dusk="output.livewire">{{ $dataArray['role'] }}</span></p> <button wire:click.prevent="submit" dusk="submit">Submit</button> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/view-toggle-entangled-turbo.blade.php
legacy_tests/Browser/Alpine/Entangle/view-toggle-entangled-turbo.blade.php
<div> <h1 dusk="page.title">{{ $title }}</h1> <div x-data="{ active: @entangle('active') }"> <div dusk="output.alpine" x-text="active"></div> <div dusk="output.livewire">{{ $active ? 'true' : 'false' }}</div> <button dusk="toggle" x-on:click="active = !active">Toggle Active</button> </div> </div>
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/ChangeMultipleDataAtTheSameTime.php
legacy_tests/Browser/Alpine/Entangle/ChangeMultipleDataAtTheSameTime.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class ChangeMultipleDataAtTheSameTime extends BaseComponent { public $livewireList = [1,2,3,4]; public $livewireSearch; public function updatedLivewireSearch() { $this->change(); } public function change() { $this->livewireList = [5,6,7,8]; } public function render() { return <<<'HTML' <div> <div x-data="{ alpineList: @entangle('livewireList').live, alpineSearch: @entangle('livewireSearch').live }"> <div> <h1>Javascript show:</h1> <div dusk="output.alpine"> <ul> <template x-for="item in alpineList"> <li x-text="item"></li> </template> </ul> </div> </div> <div> <h1>Server rendered show:</h1> <div dusk="output.livewire"> <ul> @foreach($livewireList as $item) <li>{{ $item }}</li> @endforeach </ul> </div> </div> <input dusk="search" x-model="alpineSearch" /> <button dusk="change" wire:click="change">Change List</button> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/EntangleNestedArray.php
legacy_tests/Browser/Alpine/Entangle/EntangleNestedArray.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use Livewire\Component as BaseComponent; class EntangleNestedArray extends BaseComponent { public $list = []; public function addList() { $this->list[] = ['id' => count($this->list)]; } public function removeList() { array_pop($this->list); } public function render() { return <<<'HTML' <div> <div dusk="output"> @foreach($list as $key => $item) <div wire:key="{{ $key }}" x-data="{ id: $wire.entangle('list.{{ $key }}.id') }"> <span>Item{{ $item['id'] }}</span> </div> @endforeach </div> <div> <button dusk="add" type="button" wire:click="addList">Add</button> <button dusk="remove" type="button" wire:click="removeList">Delete</button> </div> </div> HTML; } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false
livewire/livewire
https://github.com/livewire/livewire/blob/f2f58e728b8e834780be780ee727a85e9513d56b/legacy_tests/Browser/Alpine/Entangle/Test.php
legacy_tests/Browser/Alpine/Entangle/Test.php
<?php namespace LegacyTests\Browser\Alpine\Entangle; use LegacyTests\Browser\TestCase; class Test extends TestCase { public function test() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, [ Component::class, ]) /** * Can mutate an array in Alpine and reflect in Livewire. */ ->assertDontSeeIn('@output.alpine', 'baz') ->assertDontSeeIn('@output.blade', 'baz') ->waitForLivewire()->click('@button') ->assertSeeIn('@output.alpine', 'baz') ->assertSeeIn('@output.blade', 'baz') /** * Can conditionally load in a new Alpine component that uses @entangle */ ->assertNotPresent('@bob.alpine') ->assertSeeIn('@bob.blade', 'before') ->waitForLivewire()->click('@bob.show') ->assertSeeIn('@bob.alpine', 'before') ->assertSeeIn('@bob.blade', 'before') ->waitForLivewire()->click('@bob.button') ->assertSeeIn('@bob.alpine', 'after') ->assertSeeIn('@bob.blade', 'after') ; }); } public function test_watcher_is_fired_when_entangled_update_changes_other_entangled_data() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, ChangeMultipleDataAtTheSameTime::class) ->assertSeeIn('@output.alpine', 1) ->assertSeeIn('@output.alpine', 2) ->assertSeeIn('@output.alpine', 3) ->assertSeeIn('@output.alpine', 4) ->assertSeeIn('@output.livewire', 1) ->assertSeeIn('@output.livewire', 2) ->assertSeeIn('@output.livewire', 3) ->assertSeeIn('@output.livewire', 4) ->waitForLivewire()->type('@search', 's') ->assertSeeIn('@output.alpine', 5) ->assertSeeIn('@output.alpine', 6) ->assertSeeIn('@output.alpine', 7) ->assertSeeIn('@output.alpine', 8) ->assertSeeIn('@output.livewire', 5) ->assertSeeIn('@output.livewire', 6) ->assertSeeIn('@output.livewire', 7) ->assertSeeIn('@output.livewire', 8) ; }); } public function test_watcher_is_fired_each_time_entangled_data_changes() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, ToggleEntangled::class) ->assertSeeIn('@output.alpine', 'false') ->assertSeeIn('@output.livewire', 'false') ->waitForLivewire()->click('@toggle') ->assertSeeIn('@output.alpine', 'true') ->assertSeeIn('@output.livewire', 'true') ->waitForLivewire()->click('@toggle') ->assertSeeIn('@output.alpine', 'false') ->assertSeeIn('@output.livewire', 'false') ; }); } public function test_dot_defer() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, DeferDataUpdates::class) ->type('@input', 's') ->waitForLivewire()->click('@submit') ->assertSeeIn('@output.alpine', 's') ->assertSeeIn('@output.livewire', 's') ->append('@input', 's') ->waitForLivewire()->click('@submit') ->assertSeeIn('@output.alpine', 'ss') ->assertSeeIn('@output.livewire', 'ss') ; }); } public function test_dot_defer_with_nested_data() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, DeferArrayDataUpdates::class) ->assertSeeIn('@output.alpine', 'guest') ->assertSeeIn('@output.livewire', 'guest') ->select('@role-select', 'user') ->assertSeeIn('@output.alpine', 'user') ->assertSeeIn('@output.livewire', 'guest') ->waitForLivewire()->click('@submit') ->assertSeeIn('@output.alpine', 'guest') ->assertSeeIn('@output.livewire', 'guest') ; }); } public function test_entangle_does_not_throw_error_after_nested_array_removed() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, EntangleNestedArray::class) ->waitForLivewire()->click('@add') ->waitForLivewire()->click('@add') ->assertSeeIn('@output', 'Item0') ->assertSeeIn('@output', 'Item1') ->waitForLivewire()->click('@remove') ->assertSeeIn('@output', 'Item0') ->assertDontSeeIn('@output', 'Item1') ; }); } public function test_entangle_does_not_throw_wire_undefined_error_after_dynamically_adding_child_component() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, [EntangleNestedParentComponent::class, EntangleNestedChildComponent::class]) ->assertSeeIn('@livewire-output-test1', 'test1') ->assertSeeIn('@alpine-output-test1', 'test1') ->waitForLivewire()->click('@add') ->assertSeeIn('@livewire-output-test2', 'test2') ->assertSeeIn('@alpine-output-test2', 'test2') ; }); } public function test_entangle_equality_check_ensures_alpine_does_not_update_livewire() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, EntangleResponseCheck::class) ->assertSeeIn('@output', 'false') ->waitForLivewire()->click('@add') ->assertSeeIn('@output', 'false') ; }); } public function test_entangle_watchers_fire_on_consecutive_changes() { $this->browse(function ($browser) { $this->visitLivewireComponent($browser, EntangleConsecutiveActions::class) // Trigger some consecutive alpine changes ->waitForLivewire()->click('@alpineAdd') ->assertSeeIn('@alpineOutput', 0) ->assertDontSeeIn('@alpineOutput', 1) ->assertDontSeeIn('@alpineOutput', 2) ->assertSeeIn('@livewireOutput', 0) ->assertDontSeeIn('@livewireOutput', 1) ->assertDontSeeIn('@livewireOutput', 2) ->waitForLivewire()->click('@alpineAdd' ) ->assertSeeIn('@alpineOutput', 0) ->assertSeeIn('@alpineOutput', 1) ->assertDontSeeIn('@alpineOutput', 2) ->assertSeeIn('@livewireOutput', 0) ->assertSeeIn('@livewireOutput', 1) ->assertDontSeeIn('@livewireOutput', 2) ->waitForLivewire()->click('@alpineAdd') ->assertSeeIn('@alpineOutput', 0) ->assertSeeIn('@alpineOutput', 1) ->assertSeeIn('@alpineOutput', 2) ->assertSeeIn('@livewireOutput', 0) ->assertSeeIn('@livewireOutput', 1) ->assertSeeIn('@livewireOutput', 2) // Trigger some consecutive livewire changes ->waitForLivewire()->click('@livewireAdd') ->assertSeeIn('@alpineOutput', 3) ->assertDontSeeIn('@alpineOutput', 4) ->assertDontSeeIn('@alpineOutput', 5) ->assertSeeIn('@livewireOutput', 3) ->assertDontSeeIn('@livewireOutput', 4) ->assertDontSeeIn('@livewireOutput', 5) ->waitForLivewire()->click('@livewireAdd') ->assertSeeIn('@alpineOutput', 3) ->assertSeeIn('@alpineOutput', 4) ->assertDontSeeIn('@alpineOutput', 5) ->assertSeeIn('@livewireOutput', 3) ->assertSeeIn('@livewireOutput', 4) ->assertDontSeeIn('@livewireOutput', 5) ->waitForLivewire()->click('@livewireAdd') ->assertSeeIn('@alpineOutput', 3) ->assertSeeIn('@alpineOutput', 4) ->assertSeeIn('@alpineOutput', 5) ->assertSeeIn('@livewireOutput', 0) ->assertSeeIn('@livewireOutput', 4) ->assertSeeIn('@livewireOutput', 5) ; }); } public function test_entangle_works_with_turbo() { $this->browse(function ($browser) { $browser->visit(route('entangle-turbo', [], false)) ->assertSeeIn('@page.title', 'Testing Entangle with Turbo') ->click('@turbo.link') ->waitForTextIn('@page.title', 'Showing Livewire&Alpine Component after a Turbo Visit') ->assertSeeIn('@output.livewire', 'false') ->assertSeeIn('@output.alpine', 'false'); }); } }
php
MIT
f2f58e728b8e834780be780ee727a85e9513d56b
2026-01-04T15:02:34.292445Z
false