forked from livewire/livewire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2064095
commit 3ce1cae
Showing
29 changed files
with
267 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
{"/livewire.js":"df674b84"} | ||
{"/livewire.js":"4d6c4d0a"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
legacy_tests/Browser/Alpine/Dispatch/DispatchComponent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?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($eventName) | ||
{ | ||
$this->events[$eventName] = true; | ||
} | ||
|
||
public function render() | ||
{ | ||
return | ||
<<<'HTML' | ||
<div> | ||
<div x-data> | ||
<button dusk="dispatch" @click="$wire.dispatch('dispatch', 'dispatch')">Dispatch</button> | ||
@if ($events['dispatch']) | ||
Dispatch worked! | ||
@endif | ||
</div> | ||
<div x-data> | ||
<button dusk="dispatchSelf" @click="$wire.dispatchSelf('dispatch', '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; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
legacy_tests/Browser/Alpine/Dispatch/DispatchNestedComponent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?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', 'dispatchTo')">Dispatch To</button> | ||
</div> | ||
</div> | ||
HTML; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace LegacyTests\Browser\Alpine\Dispatch; | ||
|
||
use Livewire\Livewire; | ||
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') | ||
; | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.