Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing lazy props #595

Open
wants to merge 3 commits into
base: 0.x
Choose a base branch
from

Conversation

JeroenGovers
Copy link

I added the method requestProp (name open for discussion 馃槈) to the AssertableInertia class which let you easy test LazyProps.

/** @test */
public function test_props(): void
{
    $this
        ->get('/')
        ->assertInertia(function (AssertableInertia $page) {
            $page->has('normalPropKey');
            $page->missing('lazyPropKey');

            $page->requestProp('lazyPropKey', function (AssertableInertia $page) {
                $page->where('lazyPropKey', '1');
            });
        });
}

The method uses the previous request, applies the X-Inertia-Partial-Component and X-Inertia-Partial-Data headers, which are automatically seeded and resends it. A convenient way for the tester, and they do not need to know the internal mechanics of Intertia. Which I found in #604.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant