Skip to content

mpociot/missing-livewire-assertions

 
 

Repository files navigation

Missing Livewire Assertions

This Package Adds Missing Livewire Test Assertions

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds some nice new Livewire assertions which I was missing while testing my applications using Livewire.

Installation

You can install the package via composer:

composer require christophrumpel/missing-livewire-assertions

Usage

The new assertions get added automatically, so you can use it immediately.

Check if a Livewire property is wired to an HTML field

Livewire::test(FeedbackForm::class)
    ->assertPropertyWired('email');

Check if a Livewire method is wired to an HTML field

Livewire::test(FeedbackForm::class)
    ->assertMethodWired('submit');

Check if a Livewire component contains another Livewire component

Livewire::test(FeedbackForm::class)
    ->assertContainsLivewireComponent(CategoryList::class);

You can use the component tag name as well:

Livewire::test(FeedbackForm::class)
    ->assertContainsLivewireComponent('category-list');

Check if a Livewire component contains a Blade component

Livewire::test(FeedbackForm::class)
    ->assertContainsBladeComponent(Button::class);

You can use the component tag name as well:

Livewire::test(FeedbackForm::class)
    ->assertContainsBladeComponent('button');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 96.2%
  • Hack 2.7%
  • Shell 1.1%