Skip to content

Commit 5c555f7

Browse files
test: webfontloader loading fn
1 parent 99dbcae commit 5c555f7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

test/fixture/configs/default.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
webfontloader: {
1111
google: {
1212
families: ['Lato:400,700']
13+
},
14+
loading: () => {
15+
window._fontsAreLoading = true
1316
}
1417
},
1518
build: {

test/module.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ describe('nuxt-webfontloader', () => {
1414
const window = await nuxt.server.renderAndGetWindow(url('/'))
1515
await new Promise(resolve => setTimeout(resolve, 2500))
1616

17+
expect(window._fontsAreLoading).toBe(true)
18+
1719
const htmlClasses = Array.from(window.document.documentElement.classList)
1820
expect(htmlClasses).toEqual(expect.arrayContaining(['wf-loading', 'wf-lato-n4-loading', 'wf-lato-n7-loading']))
1921
})

0 commit comments

Comments
 (0)