import { defaultTheme } from '../../utils/theme' import { aliasTokensColorMap } from '../../vendor/tapestry/alias_tokens_color_map' describe('defaultTheme', () => { test('returns the dark color palette when colorScheme is "dark"', () => { expect(defaultTheme('dark').colors).toMatchObject(aliasTokensColorMap.dark) }) test('returns the light color palette when colorScheme is "light"', () => { expect(defaultTheme('light').colors).toMatchObject(aliasTokensColorMap.light) }) test('falls back to the light palette when colorScheme is null', () => { expect(defaultTheme(null).colors).toMatchObject(aliasTokensColorMap.light) }) test('falls back to the light palette for React Native 0.83\'s "unspecified" variant', () => { // RN 0.83 added "unspecified" to ColorSchemeName. Anything that is not // literally "dark" should fall through to the light palette so we never // render an unstyled or misthemed UI. expect(defaultTheme('unspecified').colors).toMatchObject(aliasTokensColorMap.light) }) describe('chip tokens', () => { test('seeds static defaults for the non-selected chip trio in both schemes', () => { const light = defaultTheme('light').colors const dark = defaultTheme('dark').colors expect(light.borderColorChip).toBe('hsl(0, 0%, 88%)') expect(light.fillColorChip).toBe('transparent') expect(light.textColorChip).toBe('hsl(0, 0%, 45%)') expect(dark.borderColorChip).toBe('hsl(0, 0%, 24%)') expect(dark.fillColorChip).toBe('transparent') expect(dark.textColorChip).toBe('hsl(0, 0%, 68%)') }) test('never seeds a static default for the selected chip trio', () => { const { colors } = defaultTheme('light') expect(colors.borderColorChipSelected).toBeUndefined() expect(colors.fillColorChipSelected).toBeUndefined() expect(colors.textColorChipSelected).toBeUndefined() }) }) })