Skip to content

Commit

Permalink
Update tests to show the correct css being applied to the stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathantneal committed Feb 13, 2021
1 parent 7da8294 commit 233355f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/core/tests/responsive-variants.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import createCss from '../src/index.js'

describe('Conditional variants', () => {
const { css, toString } = createCss({
const config = {
conditions: {
bp1: '@media (max-width: 767px)',
bp2: '@media (min-width: 768px)',
},
})
}

const config = {
const componentConfig = {
variants: {
color: {
blue: {
Expand All @@ -31,17 +31,17 @@ describe('Conditional variants', () => {
},
}

test('1. Component has a default class without any variant applied', () => {
/** Component with variants and compound variants */
const component = css(config)
const componentClassName = 'sx03kze'
// test('1. Component has a default class without any variant applied', () => {
// /** Component with variants and compound variants */
// const component = css(config)
// const componentClassName = 'sx03kze'

expect(String(component({}))).toBe(componentClassName)
})
// expect(String(component({}))).toBe(componentClassName)
// })

test('2. Component has a default class with a variant applied', () => {
/** Component with variants and compound variants */
const component = css(config)
const { css } = createCss(config)
const component = css(componentConfig)
const componentClassName = 'sx03kze'
const componentSizeTinyClassName = 'sx03kzetmy8g--size-tiny'

Expand All @@ -55,11 +55,10 @@ describe('Conditional variants', () => {
})

test('3. Component has a default class with a conditional variant applied', () => {
/** Component with variants and compound variants */
const component = css(config)
const { css, toString } = createCss(config)
const component = css(componentConfig)
const componentClassName = 'sx03kze'
const componentSizeTinyBp1ClassName = 'sx03kzetmy8g--size-tiny--5m2l7'
const componentSizeTinyCssText = '.sx03kzetmy8g--size-tiny{font-size:16px;}'
const componentSizeTinyBp1CssText = '@media (max-width: 767px){.sx03kzetmy8g--size-tiny--5m2l7{font-size:16px;}}'

expect(
Expand All @@ -72,6 +71,6 @@ describe('Conditional variants', () => {
),
).toBe([componentClassName, componentSizeTinyBp1ClassName].join(' '))

expect(String(toString())).toBe([componentSizeTinyCssText, componentSizeTinyBp1CssText].join(''))
expect(String(toString())).toBe([componentSizeTinyBp1CssText].join(''))
})
})

0 comments on commit 233355f

Please sign in to comment.