mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
test: update tests
This commit is contained in:
parent
07c9f7a6f8
commit
673b89bfa5
@ -2595,14 +2595,20 @@ describe('teleports', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Node.js compatibility for client-side', () => {
|
describe.only('experimental', () => {
|
||||||
it('should work', async () => {
|
it('decorators support works', async () => {
|
||||||
const { page } = await renderPage('/node-compat')
|
const html = await $fetch('/experimental/decorators')
|
||||||
|
expect(html).toContain('decorated-decorated')
|
||||||
|
expectNoClientErrors('/experimental/decorators')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Node.js compatibility for client-side', async () => {
|
||||||
|
const { page } = await renderPage('/experimental/node-compat')
|
||||||
await page.locator('body').getByText('Nuxt is Awesome!').waitFor()
|
await page.locator('body').getByText('Nuxt is Awesome!').waitFor()
|
||||||
expect(await page.innerHTML('body')).toContain('CWD: [available]')
|
expect(await page.innerHTML('body')).toContain('CWD: [available]')
|
||||||
await page.close()
|
await page.close()
|
||||||
})
|
}, 30_000)
|
||||||
}, 20_000)
|
})
|
||||||
|
|
||||||
function normaliseIslandResult (result: NuxtIslandResponse) {
|
function normaliseIslandResult (result: NuxtIslandResponse) {
|
||||||
return {
|
return {
|
||||||
|
1
test/fixtures/basic/nuxt.config.ts
vendored
1
test/fixtures/basic/nuxt.config.ts
vendored
@ -242,6 +242,7 @@ export default defineNuxtConfig({
|
|||||||
inlineStyles: id => !!id && !id.includes('assets.vue'),
|
inlineStyles: id => !!id && !id.includes('assets.vue'),
|
||||||
},
|
},
|
||||||
experimental: {
|
experimental: {
|
||||||
|
decorators: true,
|
||||||
typedPages: true,
|
typedPages: true,
|
||||||
polyfillVueUseHead: true,
|
polyfillVueUseHead: true,
|
||||||
respectNoSSRHeader: true,
|
respectNoSSRHeader: true,
|
||||||
|
26
test/fixtures/basic/pages/experimental/decorators.vue
vendored
Normal file
26
test/fixtures/basic/pages/experimental/decorators.vue
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
function something(_method: () => unknown) {
|
||||||
|
return () => 'decorated'
|
||||||
|
}
|
||||||
|
|
||||||
|
class SomeClass {
|
||||||
|
@something
|
||||||
|
public someMethod() {
|
||||||
|
return 'initial'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = new SomeClass().someMethod()
|
||||||
|
|
||||||
|
const { data } = await useFetch('/api/experimental/decorators')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
{{ value }}-{{ data }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
14
test/fixtures/basic/server/api/experimental/decorators.ts
vendored
Normal file
14
test/fixtures/basic/server/api/experimental/decorators.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export default eventHandler((_event) => {
|
||||||
|
function something(_method: () => unknown) {
|
||||||
|
return () => 'decorated'
|
||||||
|
}
|
||||||
|
|
||||||
|
class SomeClass {
|
||||||
|
@something
|
||||||
|
public someMethod() {
|
||||||
|
return 'initial'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SomeClass().someMethod()
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user