diff --git a/lib/head.js b/lib/head.js index ef206c54ea..5454df8f9b 100644 --- a/lib/head.js +++ b/lib/head.js @@ -29,7 +29,7 @@ function reduceComponents (components) { return a.concat(b) }, []) .reverse() - .concat(defaultHead()) + .concat(defaultHead('')) .filter(Boolean) .filter(unique()) .reverse() diff --git a/test/integration/basic/pages/default-head.js b/test/integration/basic/pages/default-head.js new file mode 100644 index 0000000000..fca3d30760 --- /dev/null +++ b/test/integration/basic/pages/default-head.js @@ -0,0 +1,7 @@ +import React from 'react' +import Head from 'next/head' + +export default () =>
+ +

next-head, but only once.

+
diff --git a/test/integration/basic/test/index.test.js b/test/integration/basic/test/index.test.js index 3785906d9e..4a5cbbba53 100644 --- a/test/integration/basic/test/index.test.js +++ b/test/integration/basic/test/index.test.js @@ -28,6 +28,7 @@ describe('Basic Features', () => { // pre-build all pages at the start await Promise.all([ renderViaHTTP(context.appPort, '/async-props'), + renderViaHTTP(context.appPort, '/default-head'), renderViaHTTP(context.appPort, '/empty-get-initial-props'), renderViaHTTP(context.appPort, '/error'), renderViaHTTP(context.appPort, '/finish-response'), diff --git a/test/integration/basic/test/rendering.js b/test/integration/basic/test/rendering.js index 3f375edceb..b82ef61a6d 100644 --- a/test/integration/basic/test/rendering.js +++ b/test/integration/basic/test/rendering.js @@ -26,6 +26,13 @@ export default function ({ app }, suiteName, render, fetch) { expect(answer.text()).toBe('The answer is 42') }) + // default-head contains an empty . + test('header renders default charset', async () => { + const html = await (render('/default-head')) + expect(html.includes('')).toBeTruthy() + expect(html.includes('next-head, but only once.')).toBeTruthy() + }) + test('header helper renders header information', async () => { const html = await (render('/head')) expect(html.includes('')).toBeTruthy()