claudiodekker / inertia-laravel-testing

Testing helpers for https://github.com/inertiajs/inertia-laravel
MIT License
134 stars 6 forks source link

[Question] Test partial reload? #36

Closed robsontenorio closed 3 years ago

robsontenorio commented 3 years ago

Some controllers have Inertia::lazy(...)

How to properly test partial reload for that variables?

claudiodekker commented 3 years ago

Hi,

In short, this is currently only possible by manually making a request that uses the same headers that Inertia would use internally when requesting to load lazy props. Specifically, the headers you'll want to set are the following two:

'X-Inertia-Partial-Component' => 'TheRequestPageComponentName',
'X-Inertia-Partial-Data': 'a,comma,separated,list,of,props',

Unfortunately this isn't something we can currently support just yet, but we might revisit this in the near future once the libraries are merged.

Hope this helps!