test: disable pageTransition in client-only page (#27839)

This commit is contained in:
Julien Huang 2024-07-23 22:44:35 +02:00 committed by GitHub
parent d5023955d3
commit e5a7a58d49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View File

@ -533,8 +533,7 @@ describe('pages', () => {
await clientInitialPage.waitForFunction(() => window.useNuxtApp?.()._route.fullPath === '/client-only-page/normal')
// that page should be client rendered
// TODO: investigate why multiple elements are appearing on page
expect(await clientInitialPage.locator('#server-rendered').first().textContent()).toMatchInlineSnapshot('"false"')
expect(await clientInitialPage.locator('#server-rendered').textContent()).toMatchInlineSnapshot('"false"')
// and not contain any errors or warnings
expect(errors.length).toBe(0)

View File

@ -1,4 +1,10 @@
<script setup lang="ts">
definePageMeta({
// Disable page transition for this page to avoid having multiple time the same page during transition
pageTransition: false,
layoutTransition: false,
})
const state = useState('test', () => {
let hasAccessToWindow = null as null | boolean

View File

@ -1,5 +1,10 @@
<script setup lang="ts">
const renderedOnServer = useState(() => import.meta.server)
definePageMeta({
// Disable page transition for this page to avoid having multiple time the same page during transition
pageTransition: false,
layoutTransition: false,
})
</script>
<template>