tailwindcss/tests/screenAtRule.test.js
Robin Malfait 44b3b429a8
Cleanup oxide — Part #2 (#13312)
* remove all oxide related code

* Update lightningcss to version 1.24.1

* update tests to match bumped Lightning CSS output

---------

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2024-03-22 17:12:14 +01:00

59 lines
1.1 KiB
JavaScript

import postcss from 'postcss'
import plugin from '../src/lib/substituteScreenAtRules'
import config from '../stubs/config.full.js'
import { css } from './util/run'
function run(input, opts = config) {
return postcss([plugin({ tailwindConfig: opts })]).process(input, { from: undefined })
}
test('it can generate media queries from configured screen sizes', () => {
let input = css`
@screen sm {
.banana {
color: yellow;
}
}
@screen md {
.banana {
color: red;
}
}
@screen lg {
.banana {
color: green;
}
}
`
return run(input, {
theme: {
screens: {
sm: '500px',
md: '750px',
lg: '1000px',
},
},
separator: ':',
}).then((result) => {
expect(result.css).toMatchFormattedCss(css`
@media (min-width: 500px) {
.banana {
color: #ff0;
}
}
@media (min-width: 750px) {
.banana {
color: red;
}
}
@media (min-width: 1000px) {
.banana {
color: green;
}
}
`)
expect(result.warnings().length).toBe(0)
})
})