Skip to content

Commit

Permalink
Fix failing tests for ThemeSet
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Aug 30, 2024
1 parent f37ecd9 commit 2a84a7a
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions test/theme_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ describe('ThemeSet', () => {
expect(instance.themeMap).toBeInstanceOf(Map)
expect({}.propertyIsEnumerable.call(instance, 'themeMap')).toBe(false)
})

context('cssNesting option', () => {
it('has cssNesting property as false by default', () =>
expect(instance.cssNesting).toBe(false))

it('has cssNesting property as true when passed as true', () => {
instance = new ThemeSet({ cssNesting: true })
expect(instance.cssNesting).toBe(true)
})

it('has cssNesting property as false when passed as false', () => {
instance = new ThemeSet({ cssNesting: false })
expect(instance.cssNesting).toBe(false)
})
})
})

describe('get #size', () => {
Expand Down Expand Up @@ -52,7 +67,19 @@ describe('ThemeSet', () => {

it('passes an empty metaType option to Theme.fromCSS', () => {
instance.add('/* @theme a */')
expect(spy).toBeCalledWith('/* @theme a */', { metaType: {} })
expect(spy).toBeCalledWith(
'/* @theme a */',
expect.objectContaining({ metaType: {} }),
)
})

it('passes cssNesting option to Theme.fromCSS', () => {
instance.cssNesting = false
instance.add('/* @theme a */')
expect(spy).toBeCalledWith(
'/* @theme a */',
expect.objectContaining({ cssNesting: false }),
)
})

context("when ThemeSet's metaType property has changed", () => {
Expand All @@ -62,7 +89,10 @@ describe('ThemeSet', () => {
instance.metaType = metaType
instance.add('/* @theme c */')

expect(spy).toBeCalledWith('/* @theme c */', { metaType })
expect(spy).toBeCalledWith(
'/* @theme c */',
expect.objectContaining({ metaType }),
)
})
})
})
Expand Down

0 comments on commit 2a84a7a

Please sign in to comment.