{"id":15016857,"url":"https://github.com/christophrumpel/missing-livewire-assertions","last_synced_at":"2025-05-15T15:01:51.251Z","repository":{"id":42473947,"uuid":"359525003","full_name":"christophrumpel/missing-livewire-assertions","owner":"christophrumpel","description":"Adding the missing Livewire assertions to your Laravel project","archived":false,"fork":false,"pushed_at":"2025-04-15T10:30:57.000Z","size":130,"stargazers_count":141,"open_issues_count":3,"forks_count":26,"subscribers_count":4,"default_branch":"production","last_synced_at":"2025-04-15T11:39:35.312Z","etag":null,"topics":["laravel","livewire"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christophrumpel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-19T16:23:41.000Z","updated_at":"2025-04-15T10:30:53.000Z","dependencies_parsed_at":"2024-11-04T10:18:29.442Z","dependency_job_id":"eec0709c-89a0-45b2-bee8-186612edfba6","html_url":"https://github.com/christophrumpel/missing-livewire-assertions","commit_stats":{"total_commits":113,"total_committers":23,"mean_commits":4.913043478260869,"dds":0.7610619469026548,"last_synced_commit":"3075093b0e5229bccfb768f32ce5f42736d1c1f5"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophrumpel%2Fmissing-livewire-assertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophrumpel%2Fmissing-livewire-assertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophrumpel%2Fmissing-livewire-assertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophrumpel%2Fmissing-livewire-assertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christophrumpel","download_url":"https://codeload.github.com/christophrumpel/missing-livewire-assertions/tar.gz/refs/heads/production","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364264,"owners_count":22058877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","livewire"],"created_at":"2024-09-24T19:49:29.065Z","updated_at":"2025-05-15T15:01:51.181Z","avatar_url":"https://github.com/christophrumpel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CleanShot 2023-02-14 at 17 17 03@2x](https://user-images.githubusercontent.com/1394539/218795579-da45e8c0-2f7d-44d9-9e50-08fd8c99aa6b.png)\n# This Package Adds Missing Livewire Test Assertions\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/christophrumpel/missing-livewire-assertions.svg?style=flat-square)](https://packagist.org/packages/christophrumpel/missing-livewire-assertions)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/christophrumpel/missing-livewire-assertions/run-tests?label=tests)](https://github.com/christophrumpel/missing-livewire-assertions/actions?query=workflow%3Arun-tests+branch%3Aproduction)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/christophrumpel/missing-livewire-assertions/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/christophrumpel/missing-livewire-assertions/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Aproduction)\n[![Total Downloads](https://img.shields.io/packagist/dt/christophrumpel/missing-livewire-assertions.svg?style=flat-square)](https://packagist.org/packages/christophrumpel/missing-livewire-assertions)\n\nThis package adds some nice new Livewire assertions which I was missing while testing my applications using Livewire. If you want to know more about WHY I needed them, check out my [blog article](https://christoph-rumpel.com/2021/4/how-I-test-livewire-components).\n\n➡️ `Version 2.0` of this package only supports `Livewire 3`. Please use a lower version of this package for other Livewire versions.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require christophrumpel/missing-livewire-assertions\n```\n\n## Usage\n\nThe new assertions get added automatically, so you can use them immediately.\n\n### Check if a Livewire property is wired to an HTML field\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertPropertyWired('email');\n```\n\nIt looks for a string like `wire:model=\"email\"` in your component's view file. It also detects variations like `wire:model.live=\"email\"`, `wire:model.lazy=\"email\"`, `wire:model.debounce=\"email\"`, `wire:model.lazy.10s=\"email\"` or `wire:model.debounce.500ms=\"email\"`.\n\n### Check if a Livewire method is wired to an HTML field\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWired('submit');\n```\nIt looks for a string like `wire:click=\"submit\"` in your component's view file. \n\n### Check if a Livewire magic action is wired to an HTML field\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWired('$toggle(\\'sortAsc\\')');\n```\n\n### Check if a generic Livewire method is wired to an HTML field\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWiredToAction('mouseenter', 'enter');\n```\n\nIt looks for a string like `wire:mouseenter=\"enter\"` in your component's view file. Also, note that it can also look for any events, like `wire:keydown` or `wire:custom-event`.\n\nIt looks for a string like `wire:click=\"$refresh\"`, `wire:click=\"$toggle('sortAsc')`, `$dispatch('post-created')`, along with all other [magic actions](https://livewire.laravel.com/docs/actions#magic-actions). When testing for magic actions, you must escape single quotes like shown above.\n\n### Check if a Livewire method is wired to an HTML form\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWiredToForm('upload');\n```\n\nIt looks for a string like `wire:submit.prevent=\"upload\"` in your component's view file.\n\n### Check if a Livewire method is wired to a specific javascript event\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWiredToEvent('setValue', 'change');\n```\n\nIt looks for a string like `wire:change.debounce.150ms=\"setValue\"` in your component's view file.\n\nYou can also check for actions without any additional modifiers: \n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWiredToEventWithoutModifiers('reset', 'keyup');\n```\n\nThis will match `wire:keyup=\"reset\"`, but not `wire:keyup.escape=\"reset\"`. You could match that with\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertMethodWiredToEventWithoutModifiers('reset', 'keyup.escape');\n```\n\n### Check if a Livewire component contains another Livewire component\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertContainsLivewireComponent(CategoryList::class);\n```\n\nYou can use the component tag name as well:\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertContainsLivewireComponent('category-list');\n```\n\n### Check if a Livewire component contains a Blade component\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertContainsBladeComponent(Button::class);\n```\n\nYou can use the component tag name as well:\n\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertContainsBladeComponent('button');\n```\n\n### Check to see if a string comes before another string\n```php\nLivewire::test(FeedbackForm::class)\n    -\u003eassertSeeBefore('first string', 'second string');\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Christoph Rumpel](https://github.com/christophrumpel)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophrumpel%2Fmissing-livewire-assertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophrumpel%2Fmissing-livewire-assertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophrumpel%2Fmissing-livewire-assertions/lists"}