mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Run test suite against both engines * make eslint happy * only run `stable` tests on Node 12 * use normal expectation instead of snapshot file When we run the tests only against `stable` (for node 12), then the snapshots exists for the `Oxide` build. They are marked as `obsolete` and will cause the `npm run test` script to fail. Sadly. Inlined them for now, but ideally we make those tests more blackbox-y so that we test that we get source maps and that we can map the sourcemap back to the input files (without looking at the actual annotations). * properly indent inline css Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
import { normalizeScreens } from '../src/util/normalizeScreens'
|
|
import { crosscheck } from './util/run'
|
|
|
|
crosscheck(() => {
|
|
it('should normalize an array of string values', () => {
|
|
let screens = ['768px', '1200px']
|
|
|
|
expect(normalizeScreens(screens)).toEqual([
|
|
{ name: '768px', not: false, values: [{ min: '768px', max: undefined }] },
|
|
{ name: '1200px', not: false, values: [{ min: '1200px', max: undefined }] },
|
|
])
|
|
})
|
|
|
|
it('should normalize an object with string values', () => {
|
|
let screens = {
|
|
a: '768px',
|
|
b: '1200px',
|
|
}
|
|
|
|
expect(normalizeScreens(screens)).toEqual([
|
|
{ name: 'a', not: false, values: [{ min: '768px', max: undefined }] },
|
|
{ name: 'b', not: false, values: [{ min: '1200px', max: undefined }] },
|
|
])
|
|
})
|
|
|
|
it('should normalize an object with object values', () => {
|
|
let screens = {
|
|
a: { min: '768px' },
|
|
b: { max: '1200px' },
|
|
}
|
|
|
|
expect(normalizeScreens(screens)).toEqual([
|
|
{ name: 'a', not: false, values: [{ min: '768px', max: undefined }] },
|
|
{ name: 'b', not: false, values: [{ min: undefined, max: '1200px' }] },
|
|
])
|
|
})
|
|
|
|
it('should normalize an object with multiple object values', () => {
|
|
let screens = {
|
|
a: [{ min: '768px' }, { max: '1200px' }],
|
|
}
|
|
|
|
expect(normalizeScreens(screens)).toEqual([
|
|
{
|
|
name: 'a',
|
|
not: false,
|
|
values: [
|
|
{ max: undefined, min: '768px', raw: undefined },
|
|
{ max: '1200px', min: undefined, raw: undefined },
|
|
],
|
|
},
|
|
])
|
|
})
|
|
|
|
it('should normalize an object with object values (min-width normalized to width)', () => {
|
|
let screens = {
|
|
a: { 'min-width': '768px' },
|
|
b: { max: '1200px' },
|
|
}
|
|
|
|
expect(normalizeScreens(screens)).toEqual([
|
|
{ name: 'a', not: false, values: [{ min: '768px', max: undefined }] },
|
|
{ name: 'b', not: false, values: [{ min: undefined, max: '1200px' }] },
|
|
])
|
|
})
|
|
})
|