diff --git a/test/fixtures/with-config/assets/app.css b/test/fixtures/with-config/assets/app.css index f69fcd8bbc..6b41464a8d 100755 --- a/test/fixtures/with-config/assets/app.css +++ b/test/fixtures/with-config/assets/app.css @@ -1,3 +1,15 @@ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: local('Roboto'), local('Roboto-Regular'), url(../assets/roboto.woff2) format('woff2'); + unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; +} + +body { + font-family: 'Roboto'; +} + .global-css-selector { color: red; } diff --git a/test/fixtures/with-config/assets/roboto.woff2 b/test/fixtures/with-config/assets/roboto.woff2 new file mode 100644 index 0000000000..555f98b120 Binary files /dev/null and b/test/fixtures/with-config/assets/roboto.woff2 differ diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index adf8eac489..a17928867e 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -27,7 +27,7 @@ module.exports = { string: 'Nuxt.js' }, build: { - extractCSS: true, + // extractCSS: true, publicPath: '/orion/', analyze: { analyzerMode: 'disabled', @@ -46,6 +46,11 @@ module.exports = { http2: { push: true }, + bundleRenderer: { + shouldPreload: (file, type) => { + return ['script', 'style', 'font'].includes(type) + } + }, static: { maxAge: '1y' } diff --git a/test/with-config.test.js b/test/with-config.test.js index 2dacdca53f..c92e2b5fd2 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -26,9 +26,13 @@ test('/', async t => { }) test('/ (global styles inlined)', async t => { - // const { html } = await nuxt.renderRoute('/') - // t.true(html.includes('.global-css-selector')) - t.pass() + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('.global-css-selector')) +}) + +test('/ (preload fonts)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes(' { @@ -87,7 +91,7 @@ test('/test/about-bis (added with extendRoutes)', async t => { test('Check stats.json generated by build.analyze', t => { const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json')) - t.is(stats.assets.length, 28) + t.is(stats.assets.length, 27) }) test('Check /test/test.txt with custom serve-static options', async t => {