Skip to content

Commit 774446b

Browse files
committed
1 parent 777a4b7 commit 774446b

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

Diff for: test/e2e/children.patch.browser.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,26 @@ describe('children patch (browser)', () => {
153153
})
154154
})
155155

156+
describe('refresh child component if param and query is changed and watchQuery is true and watchParam is false', () => {
157+
test('Navigate to /patch/2/child-param/1?test=true', async () => {
158+
await page.nuxt.navigate('/patch/2/child-param/1?test=true')
159+
dates.slug = await page.$text('[data-date-slug]')
160+
161+
expect(dates.patch).toBe(await page.$text('[data-date-patch]'))
162+
expect(dates.id).toBe(await page.$text('[data-date-id]'))
163+
})
164+
165+
test('Navigate to /patch/2/child-param/2#test', async () => {
166+
await page.nuxt.navigate('/patch/2/child-param/2#test')
167+
const slug = await page.$text('[data-date-slug]')
168+
169+
expect(+dates.slug < +slug).toBe(true)
170+
expect(dates.patch).toBe(await page.$text('[data-date-patch]'))
171+
expect(dates.id).toBe(await page.$text('[data-date-id]'))
172+
dates.slug = slug
173+
})
174+
})
175+
156176
// Close server and ask nuxt to stop listening to file changes
157177
afterAll(async () => {
158178
await nuxt.close()

Diff for: test/fixtures/children/layouts/patch.vue

+10
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@
5757
/patch/2/reuse/2
5858
</NuxtLink>
5959
</li>
60+
<li>
61+
<NuxtLink data-test-id="patch-id-2-child-param-1" to="/patch/2/child-param/1?test=true">
62+
/patch/2/child-param/1?test=true
63+
</NuxtLink>
64+
</li>
65+
<li>
66+
<NuxtLink data-test-id="patch-id-2-child-param-2" to="/patch/2/child-param/2#test">
67+
/patch/2/child-param/2#test
68+
</NuxtLink>
69+
</li>
6070
</ul>
6171
</div>
6272
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div>
3+
<h4>
4+
_slug: <i data-date-slug>
5+
{{ date }}
6+
</i>
7+
</h4>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
watchParam: false,
14+
watchQuery: true,
15+
asyncData () {
16+
return {
17+
date: Date.now()
18+
}
19+
}
20+
}
21+
</script>

0 commit comments

Comments
 (0)