Commit 753113bb authored by Arunoda Susiripala's avatar Arunoda Susiripala

Add some tests for dynamic rendering.

parent 7fcd1ea7
export default () => (
<p>Hello World 1</p>
)
import dynamic from 'next/dynamic'
const Hello = dynamic(import('../../components/hello1'), {
ssr: false,
loading: () => (<p>LOADING</p>)
})
export default Hello
import dynamic from 'next/dynamic'
const Hello = dynamic(import('../../components/hello1'), { ssr: false })
export default Hello
import dynamic from 'next/dynamic'
const Hello = dynamic(import('../../components/hello1'))
export default Hello
...@@ -74,5 +74,20 @@ export default function ({ app }, suiteName, render) { ...@@ -74,5 +74,20 @@ export default function ({ app }, suiteName, render) {
expect($('h1').text()).toBe('404') expect($('h1').text()).toBe('404')
expect($('h2').text()).toBe('This page could not be found.') expect($('h2').text()).toBe('This page could not be found.')
}) })
test('render dynmaic import components via SSR', async () => {
const $ = await get$('/dynamic/ssr')
expect($('p').text()).toBe('Hello World 1')
})
test('stop render dynmaic import components in SSR', async () => {
const $ = await get$('/dynamic/no-ssr')
expect($('p').text()).toBe('loading...')
})
test('stop render dynmaic import components in SSR with custom loading', async () => {
const $ = await get$('/dynamic/no-ssr-custom-loading')
expect($('p').text()).toBe('LOADING')
})
}) })
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment