Skip to content

Commit 78646a3

Browse files
authored
Docs about the inertiaProps testing method (#416)
* Docs about the `inertiaProps` testing method * Update testing.jsx
1 parent 3a0e6f5 commit 78646a3

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
@@ -86,7 +86,26 @@ export default function () {
8686
scope your assertions.
8787
</P>
8888
<P>
89-
Let's dig into the available assertions in detail. First, to assert that the Inertia response has a property,
89+
You may use the <Code>inertiaProps</Code> method to retrieve the props returned in the response.
90+
You can pass a key to retrieve a specific property, and nested properties are supported using "dot" notation.
91+
</P>
92+
<CodeBlock
93+
language="php"
94+
children={dedent`
95+
$response = $this->get('/podcasts/41');
96+
97+
// Returns all props...
98+
$response->inertiaProps();
99+
100+
// Returns a specific prop...
101+
$response->inertiaProps('podcast');
102+
103+
// Returns a nested prop using "dot" notation...
104+
$response->inertiaProps('podcast.id');
105+
`}
106+
/>
107+
<P>
108+
Let's dig into the <Code>assertInertia</Code> method and the available assertions in detail. First, to assert that the Inertia response has a property,
90109
you may use the <Code>has</Code> method. You can think of this method as being similar to PHP's{' '}
91110
<Code>isset</Code> function.
92111
</P>

0 commit comments

Comments
 (0)