diff --git a/test/integration/basic/components/hello1.js b/test/integration/basic/components/hello1.js new file mode 100644 index 00000000..a896f64f --- /dev/null +++ b/test/integration/basic/components/hello1.js @@ -0,0 +1,3 @@ +export default () => ( +
Hello World 1
+) diff --git a/test/integration/basic/pages/dynamic/no-ssr-custom-loading.js b/test/integration/basic/pages/dynamic/no-ssr-custom-loading.js new file mode 100644 index 00000000..8b1dc363 --- /dev/null +++ b/test/integration/basic/pages/dynamic/no-ssr-custom-loading.js @@ -0,0 +1,8 @@ +import dynamic from 'next/dynamic' + +const Hello = dynamic(import('../../components/hello1'), { + ssr: false, + loading: () => (LOADING
) +}) + +export default Hello diff --git a/test/integration/basic/pages/dynamic/no-ssr.js b/test/integration/basic/pages/dynamic/no-ssr.js new file mode 100644 index 00000000..a0818a39 --- /dev/null +++ b/test/integration/basic/pages/dynamic/no-ssr.js @@ -0,0 +1,5 @@ +import dynamic from 'next/dynamic' + +const Hello = dynamic(import('../../components/hello1'), { ssr: false }) + +export default Hello diff --git a/test/integration/basic/pages/dynamic/ssr.js b/test/integration/basic/pages/dynamic/ssr.js new file mode 100644 index 00000000..6bec25ce --- /dev/null +++ b/test/integration/basic/pages/dynamic/ssr.js @@ -0,0 +1,5 @@ +import dynamic from 'next/dynamic' + +const Hello = dynamic(import('../../components/hello1')) + +export default Hello diff --git a/test/integration/basic/test/rendering.js b/test/integration/basic/test/rendering.js index 69cf619b..d357cf27 100644 --- a/test/integration/basic/test/rendering.js +++ b/test/integration/basic/test/rendering.js @@ -74,5 +74,20 @@ export default function ({ app }, suiteName, render) { expect($('h1').text()).toBe('404') 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') + }) }) }