diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cbec7cd..1efaa72 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,8 +13,8 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.1] - laravel: ['9.50', 10] + php: [8.1, 8.2] + laravel: [10] coverage-driver: [pcov] stability: [prefer-lowest, prefer-stable] diff --git a/composer.json b/composer.json index e9c4892..05c02b8 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": "^8.1", - "livewire/livewire": "^2.0", - "illuminate/contracts": "^9.5|^10.0", - "illuminate/database": "^9.5|^10.0", - "illuminate/support": "^9.5|^10.0" + "php": "^8.1|^8.2", + "livewire/livewire": "^3.1", + "illuminate/contracts": "^10.0", + "illuminate/database": "^10.0", + "illuminate/support": "^10.0" }, "require-dev": { "orchestra/testbench": "^7.5|^8.0", diff --git a/src/Components/Combobox.php b/src/Components/Combobox.php index 121e40b..aac12a3 100644 --- a/src/Components/Combobox.php +++ b/src/Components/Combobox.php @@ -162,7 +162,7 @@ protected function selectModel(mixed $model, bool $silent = false): void { } if (!$silent) { - $this->emitUp("selected-$this->name", $model); + $this->dispatch("selected-$this->name", $model); } } @@ -172,6 +172,6 @@ protected function selectModel(mixed $model, bool $silent = false): void { protected function clearSelection(): void { $this->selected = null; - $this->emitUp("cleared-$this->name"); + $this->dispatch("cleared-$this->name"); } } diff --git a/tests/AllowCreationComboboxTest.php b/tests/AllowCreationComboboxTest.php index 44e2aa2..d0d9ee5 100644 --- a/tests/AllowCreationComboboxTest.php +++ b/tests/AllowCreationComboboxTest.php @@ -19,8 +19,8 @@ public function test_can_create_new_models(): void { $component->assertSuccessful() ->assertSee('Posts') ->assertSee('Create Another Post', false) - ->assertNotEmitted('selected-posts') - ->assertNotEmitted('cleared-posts'); + ->assertNotDispatched('selected-posts') + ->assertNotDispatched('cleared-posts'); $this->assertDatabaseCount('posts', 3); @@ -28,8 +28,8 @@ public function test_can_create_new_models(): void { $post = Post::query()->where('title', 'Another Post')->first(); - $component->assertEmitted('selected-posts') - ->assertNotEmitted('cleared-posts') + $component->assertDispatched('selected-posts') + ->assertNotDispatched('cleared-posts') ->assertSet('selected', $post); $this->assertDatabaseCount('posts', 4); diff --git a/tests/BasicComboboxTest.php b/tests/BasicComboboxTest.php index f8f77f4..eb974eb 100644 --- a/tests/BasicComboboxTest.php +++ b/tests/BasicComboboxTest.php @@ -26,8 +26,8 @@ public function test_can_render(): void { $component->assertSee('Users'); $component->assertSee('Select a user'); - $component->assertNotEmitted('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); } /** @@ -50,8 +50,8 @@ public function test_can_render_available_results(): void { $component->assertSee('User C'); $component->assertDontSee('Other'); - $component->assertNotEmitted('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); } /** @@ -74,8 +74,8 @@ public function test_can_select_automatically_the_only_option(): void { $component->assertDontSee('User C'); $component->assertSee('Other'); - $component->assertEmittedUp('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); } /** @@ -101,8 +101,8 @@ public function test_an_option_can_be_selected(): void { $component->assertDontSee('User C'); $component->assertDontSee('Other'); - $component->assertEmittedUp('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); } /** @@ -127,8 +127,8 @@ public function test_selected_option_is_cleared_when_the_search_has_changed(): v $component->assertDontSee('User C'); $component->assertDontSee('Other'); - $component->assertEmittedUp('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); $component = $component->set('search', 'User'); @@ -140,8 +140,8 @@ public function test_selected_option_is_cleared_when_the_search_has_changed(): v $component->assertSee('User C'); $component->assertDontSee('Other'); - $component->assertNotEmitted('selected-users'); - $component->assertEmittedUp('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertDispatched('cleared-users'); } /** @@ -166,8 +166,8 @@ public function test_selected_option_is_cleared_when_the_search_has_been_cleared $component->assertDontSee('User C'); $component->assertDontSee('Other'); - $component->assertEmittedUp('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); $component = $component->set('search', ''); @@ -179,8 +179,8 @@ public function test_selected_option_is_cleared_when_the_search_has_been_cleared $component->assertDontSee('User C'); $component->assertDontSee('Other'); - $component->assertNotEmitted('selected-users'); - $component->assertEmittedUp('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertDispatched('cleared-users'); } public function test_can_render_with_a_custom_search_placeholder(): void { @@ -214,8 +214,8 @@ public function test_can_be_mounted_with_an_initial_model(): void { $component->assertDontSee('User C'); $component->assertDontSee('Other'); - $component->assertEmittedUp('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); $component = $component->set('search', 'User'); @@ -226,8 +226,8 @@ public function test_can_be_mounted_with_an_initial_model(): void { $component->assertSee('User C'); $component->assertDontSee('Other'); - $component->assertNotEmitted('selected-users'); - $component->assertEmittedUp('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertDispatched('cleared-users'); } public function test_initial_value_ignored_if_not_an_instance_of_search_model(): void { @@ -244,7 +244,7 @@ public function test_initial_value_ignored_if_not_an_instance_of_search_model(): $component->assertSee('Users'); $component->assertSee('Select an option'); - $component->assertNotEmitted('selected-users'); - $component->assertNotEmitted('cleared-users'); + $component->assertNotDispatched('selected-users'); + $component->assertNotDispatched('cleared-users'); } } diff --git a/tests/DontKeepSelectionComboboxTest.php b/tests/DontKeepSelectionComboboxTest.php index ff77743..91d90cc 100644 --- a/tests/DontKeepSelectionComboboxTest.php +++ b/tests/DontKeepSelectionComboboxTest.php @@ -24,12 +24,12 @@ public function test_resets_properties_when_keep_selection_is_false(): void { ->assertSee('User B') ->assertSee('User C') ->assertDontSee('Other') - ->assertNotEmitted('selected-users') - ->assertNotEmitted('cleared-users'); + ->assertNotDispatched('selected-users') + ->assertNotDispatched('cleared-users'); $component->call('select', 1) - ->assertEmittedUp('selected-users') - ->assertNotEmitted('cleared-users') + ->assertDispatched('selected-users') + ->assertNotDispatched('cleared-users') ->assertSet('selected', null); } } diff --git a/tests/database/database.sqlite b/tests/database/database.sqlite index 0398cfb..4df6c31 100644 Binary files a/tests/database/database.sqlite and b/tests/database/database.sqlite differ