|
| 1 | +import CssConverter from '../../../src/converters/Css' |
| 2 | +import testConfig from '../../tailwind.config' |
| 3 | +import testConfigDefault from '../../tailwind-default.config' |
| 4 | +import { resolveConfig } from '../../../src/converters/utils' |
| 5 | + |
| 6 | +describe('Css converter', () => { |
| 7 | + describe('full config', () => { |
| 8 | + it('Converts to flat variables', () => { |
| 9 | + const converter = new CssConverter({ |
| 10 | + config: resolveConfig(testConfigDefault) |
| 11 | + }) |
| 12 | + expect(converter.convert()).toMatchSnapshot() |
| 13 | + }) |
| 14 | + }) |
| 15 | + |
| 16 | + it('converts flat and nested, with the same result', () => { |
| 17 | + let converter = new CssConverter({ |
| 18 | + config: resolveConfig(testConfig), |
| 19 | + flat: true |
| 20 | + }) |
| 21 | + const flatResult = converter.convert() |
| 22 | + |
| 23 | + converter = new CssConverter({ |
| 24 | + config: resolveConfig(testConfig), |
| 25 | + flat: false |
| 26 | + }) |
| 27 | + |
| 28 | + const nestedResult = converter.convert() |
| 29 | + |
| 30 | + expect(flatResult).toBe(nestedResult) |
| 31 | + }) |
| 32 | + |
| 33 | + it('Converts to flat variables with prefix', () => { |
| 34 | + const converter = new CssConverter({ |
| 35 | + config: resolveConfig(testConfig), |
| 36 | + flat: true, |
| 37 | + prefix: 'tw' |
| 38 | + }) |
| 39 | + expect(converter.convert()).toMatchSnapshot() |
| 40 | + }) |
| 41 | + |
| 42 | + it('Converts to nested map with prefix', () => { |
| 43 | + const converter = new CssConverter({ |
| 44 | + config: resolveConfig(testConfig), |
| 45 | + prefix: 'tw' |
| 46 | + }) |
| 47 | + expect(converter.convert()).toMatchSnapshot() |
| 48 | + }) |
| 49 | +}) |
0 commit comments