Skip to content

Commit

Permalink
test: fix snapshots and adopt concurrent mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Jiang committed Jul 9, 2024
1 parent 6b5920d commit 804393b
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 131 deletions.
10 changes: 5 additions & 5 deletions test/base.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, expect, it } from 'vitest'
import { describe, it } from 'vitest'
import { generator, uno } from '~/utils'


describe('base classname', () => {
it('"animate-in" should generate enter keyframe and css variables', async () => {
describe.concurrent('base classname', () => {
it('"animate-in" should generate enter keyframe and css variables', async ({ expect }) => {
const { css } = await uno.generate('animate-in')

expect(css).toMatchInlineSnapshot(`
Expand All @@ -14,7 +14,7 @@ describe('base classname', () => {
})


it('"animate-out" should generate exit keyframe and css variables', async () => {
it('"animate-out" should generate exit keyframe and css variables', async ({ expect }) => {
const { css } = await uno.generate('animate-out')

expect(css).toMatchInlineSnapshot(`
Expand All @@ -25,7 +25,7 @@ describe('base classname', () => {
})


it('"animation-duration" should be default to "theme.duration"', async () => {
it('"animation-duration" should be default to "theme.duration"', async ({ expect }) => {
const DURATION = '500ms'

const uno = generator({ duration: { DEFAULT: DURATION } })
Expand Down
20 changes: 10 additions & 10 deletions test/fade.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, it } from 'vitest'
import { describe, it } from 'vitest'
import { CSS_VARIABLE_PREFIX } from '@/constants'
import { CSS_VARIABLES, DECIMALS_0_TO_100, INTEGERS_0_TO_100 } from '~/data'
import { uno } from '~/utils'


describe('fade animation', () => {
describe.concurrent('fade animation', () => {
describe('fade-in', () => {
it(`should generate "${CSS_VARIABLE_PREFIX}-enter-opacity" css variable and default to "0"`, async () => {
it(`should generate "${CSS_VARIABLE_PREFIX}-enter-opacity" css variable and default to "0"`, async ({ expect }) => {
const { css } = await uno.generate('fade-in')

expect(css).toContain(`.fade-in{${CSS_VARIABLE_PREFIX}-enter-opacity:0;}`)
})


describe('percentage', () => {
it(`should covert percentages from "0" to "100"`, async () => {
it(`should convert percentages from "0" to "100"`, async ({ expect }) => {
const classnames = INTEGERS_0_TO_100.map(i => `fade-in-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand All @@ -37,7 +37,7 @@ describe('fade animation', () => {
})


it(`should also convert decimals`, async () => {
it(`should also convert decimals`, async ({ expect }) => {
const classnames = DECIMALS_0_TO_100.map(i => `fade-in-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand All @@ -56,7 +56,7 @@ describe('fade animation', () => {


describe('css variable', () => {
it(`should handle css variables`, async () => {
it(`should handle css variables`, async ({ expect }) => {
const classnames = CSS_VARIABLES.map(i => `fade-in-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand All @@ -74,15 +74,15 @@ describe('fade animation', () => {


describe('fade-out', () => {
it(`should generate "${CSS_VARIABLE_PREFIX}-exit-opacity" css variable and default to "0"`, async () => {
it(`should generate "${CSS_VARIABLE_PREFIX}-exit-opacity" css variable and default to "0"`, async ({ expect }) => {
const { css } = await uno.generate('fade-out')

expect(css).toContain(`.fade-out{${CSS_VARIABLE_PREFIX}-exit-opacity:0;}`)
})


describe('percentage', () => {
it(`should covert percentages from "0" to "100"`, async () => {
it(`should convert percentages from "0" to "100"`, async ({ expect }) => {
const classnames = INTEGERS_0_TO_100.map(i => `fade-out-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand All @@ -105,7 +105,7 @@ describe('fade animation', () => {
})


it(`should also convert decimals`, async () => {
it(`should also convert decimals`, async ({ expect }) => {
const classnames = DECIMALS_0_TO_100.map(i => `fade-out-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand All @@ -124,7 +124,7 @@ describe('fade animation', () => {


describe('css variable', () => {
it(`should handle css variables`, async () => {
it(`should handle css variables`, async ({ expect }) => {
const classnames = CSS_VARIABLES.map(i => `fade-out-${i}`)

const { matched, css } = await uno.generate(classnames.join(' '))
Expand Down
Loading

0 comments on commit 804393b

Please sign in to comment.