You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
I'm finding a need to check if a component has processed on the page.
I can always test if the HTML/text shows within the page but sometimes I want to test if a component was rendered within the page and assert that the variables are defined correctly from the passed variables.
If anyone would find this useful I would be happy to work on it and open a pull request.
Important to note: We already have testing to evaluate and render a single Blade component via $this->component(). This is outside the scope of the single component render and coming from the application get() request.
// use App\View\Components\SomeComponent;publicfunctionit_does_something_really_cool_and_shows_the_component()
{
$this->get('/my-page')
->assertOk()
->assertSeeComponent(SomeComponent::class);
// Assert that a component was not rendered on the page:
->assertMissingComponent(SomeComponent::class);
// Access the component properties which must evaluate to true.
->assertSeeComponent(SomeComponent::class, function ($component) {
return$component->title === 'My Page Title';
});
}
The text was updated successfully, but these errors were encountered:
ahinkle
changed the title
Assert that a component has loaded on a page
Assert that a component has rendered on a page
Jun 25, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm finding a need to check if a component has processed on the page.
I can always test if the HTML/text shows within the page but sometimes I want to test if a component was rendered within the page and assert that the variables are defined correctly from the passed variables.
If anyone would find this useful I would be happy to work on it and open a pull request.
Important to note: We already have testing to evaluate and render a single Blade component via
$this->component()
. This is outside the scope of the single component render and coming from the applicationget()
request.The text was updated successfully, but these errors were encountered: