Skip to content

Commit

Permalink
test: add test for none
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 20, 2024
1 parent a195a91 commit ddcc31a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
export default defineNuxtConfig({
modules: ['@nuxt/fonts', '@nuxtjs/tailwindcss'],
fonts: {
families: [
{
name: 'Kode Mono',
provider: 'none'
}
]
},
})
11 changes: 11 additions & 0 deletions playground/pages/none.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div>
No provider
</div>
</template>

<style scoped>
div {
font-family: 'Kode Mono';
}
</style>
2 changes: 2 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import local from './providers/local'
import { FontFamilyInjectionPlugin } from './transform'
import type { FontProvider, ModuleOptions, ResolveFontFacesOptions } from './types'

export type { ModuleOptions } from './types'

const defaultValues = {
weights: [400],
styles: ['normal', 'italic'] as const,
Expand Down
5 changes: 5 additions & 0 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ describe('providers', async () => {
`)
})

it('should allow overriding providers with `none`', async () => {
const html = await $fetch('/none')
expect(extractFontFaces('CustomFont', html)).toMatchInlineSnapshot(`[]`)
})

it('supports external files and scss syntax', async () => {
const html = await $fetch('/preprocessors')
expect(extractFontFaces('Anta', html)).toMatchInlineSnapshot(`
Expand Down

0 comments on commit ddcc31a

Please sign in to comment.