Skip to content

Commit d538a19

Browse files
authored
Section about testing partial reloads
1 parent 78646a3 commit d538a19

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

resources/js/Pages/testing.jsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { A, Code, CodeBlock, H1, H2, P } from '@/Components'
1+
import { A, Code, CodeBlock, H1, H2, H3, P } from '@/Components'
22
import dedent from 'dedent-js'
33

44
export const meta = {
@@ -230,6 +230,25 @@ export default function () {
230230
);
231231
`}
232232
/>
233+
<H3>Testing Partial Reloads</H3>
234+
<P>
235+
You may use the <Code>reloadOnly</Code> and <Code>reloadExcept</Code> methods to test how your application responds to <A href="/partial-reloads">partial reloads</A>.{' '}
236+
These methods perform a follow-up request and allow you to make assertions against the response.
237+
</P>
238+
<CodeBlock
239+
language="php"
240+
children={dedent`
241+
$response->assertInertia(fn (Assert $page) => $page
242+
->has('orders')
243+
->missing('statuses')
244+
->reloadOnly('statuses', fn (Assert $reload) => $reload
245+
->missing('orders')
246+
->has('statuses', 5)
247+
)
248+
);
249+
`}
250+
/>
251+
<P>Instead of passing a single prop as a string, you may also pass an array of props to <Code>reloadOnly</Code> or <Code>reloadExcept</Code>.</P>
233252
</>
234253
)
235254
}

0 commit comments

Comments
 (0)