Add test to make sure we're not stupidly flattening styles too early

This commit is contained in:
Adam Wathan 2018-03-06 15:57:46 -05:00
parent 8e8f47c58d
commit 3be6a04d54

View file

@ -398,6 +398,59 @@ test('plugins can create components with media queries with object syntax', () =
`)
})
test('media queries can be defined multiple times using objects-in-array syntax', () => {
const [components, utilities] = processPluginsWithValidConfig({
plugins: [
function({ addComponents }) {
addComponents([
{
'.container': {
width: '100%',
},
'@media (min-width: 100px)': {
'.container': {
maxWidth: '100px',
},
},
},
{
'.btn': {
padding: '1rem .5rem',
display: 'block',
},
'@media (min-width: 100px)': {
'.btn': {
display: 'inline-block',
},
},
},
])
},
],
})
expect(utilities.length).toBe(0)
expect(css(components)).toMatchCss(`
.container {
width: 100%
}
@media (min-width: 100px) {
.container {
max-width: 100px
}
}
.btn {
padding: 1rem .5rem;
display: block
}
@media (min-width: 100px) {
.btn {
display: inline-block
}
}
`)
})
test('plugins can create rules with escaped selectors', () => {
const config = {
plugins: [