From 2a84a7adb6732e2adfee507a1fccb3cd3fed4feb Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Sat, 31 Aug 2024 06:06:17 +0900 Subject: [PATCH] Fix failing tests for ThemeSet --- test/theme_set.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/test/theme_set.js b/test/theme_set.js index ec3976a..22e46e8 100644 --- a/test/theme_set.js +++ b/test/theme_set.js @@ -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', () => { @@ -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", () => { @@ -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 }), + ) }) }) })