forked from nuxt-modules/google-fonts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6346d7f
commit e47728b
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
rootDir: __dirname, | ||
buildModules: [ | ||
{ handler: require('../../../') } | ||
], | ||
head: { | ||
link: [ | ||
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Lato' } | ||
] | ||
}, | ||
googleFonts: { | ||
families: { | ||
Roboto: true | ||
}, | ||
useStylesheet: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div style="font-family: 'Lato'"> | ||
Works! | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils') | ||
|
||
describe('use stylesheet', () => { | ||
let nuxt | ||
|
||
beforeAll(async () => { | ||
({ nuxt } = (await setup(loadConfig(__dirname, 'use-stylesheet')))) | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
await nuxt.close() | ||
}) | ||
|
||
test('has prefetch link', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('<link data-n-head="ssr" data-hid="gf-prefetch" rel="dns-prefetch" href="https://fonts.gstatic.com/">') | ||
}) | ||
|
||
test('has preconnect link', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('<link data-n-head="ssr" data-hid="gf-preconnect" rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">') | ||
}) | ||
|
||
test('has preload link', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('<link data-n-head="ssr" data-hid="gf-preload" rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Roboto&family=Lato">') | ||
}) | ||
|
||
test('has stylesheet link', async () => { | ||
const html = await get('/') | ||
expect(html).toContain('<link data-n-head="ssr" data-hid="gf-style" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto&family=Lato">') | ||
}) | ||
|
||
test('no has script', async () => { | ||
const html = await get('/') | ||
expect(html).not.toContain('data-hid="gf-script"') | ||
}) | ||
|
||
test('not has noscript fallback', async () => { | ||
const html = await get('/') | ||
expect(html).not.toContain('data-hid="gf-noscript"') | ||
}) | ||
}) |