Skip to content

Commit 2e2677e

Browse files
committed
Add failing test
1 parent f991b6a commit 2e2677e

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

packages/css/test/index.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ test('handles negative top, left, bottom, and right from scale', () => {
259259

260260
test('skip breakpoints', () => {
261261
const result = css({
262-
width: [ '100%', , '50%' ],
262+
width: ['100%', , '50%'],
263263
})(theme)
264264
expect(result).toEqual({
265265
width: '100%',
266266
'@media screen and (min-width: 52em)': {
267267
width: '50%',
268-
}
268+
},
269269
})
270270
})
271271

@@ -290,9 +290,9 @@ test('padding shorthand does not collide with nested p selector', () => {
290290

291291
test('ignores array values longer than breakpoints', () => {
292292
const result = css({
293-
width: [ 32, 64, 128, 256, 512 ]
293+
width: [32, 64, 128, 256, 512],
294294
})({
295-
breakpoints: [ '32em', '40em' ],
295+
breakpoints: ['32em', '40em'],
296296
})
297297
expect(result).toEqual({
298298
width: 32,
@@ -403,6 +403,31 @@ test('returns outline color from theme', () => {
403403
outlineColor: 'primary',
404404
})(theme)
405405
expect(result).toEqual({
406-
outlineColor: 'tomato'
406+
outlineColor: 'tomato',
407+
})
408+
})
409+
410+
test('returns correct media query order', () => {
411+
const result = css({
412+
width: ['100%', , '50%'],
413+
color: ['red', 'green', 'blue'],
414+
})(theme)
415+
const keys = Object.keys(result)
416+
expect(keys).toEqual([
417+
'width',
418+
'color',
419+
'@media screen and (min-width: 40em)',
420+
'@media screen and (min-width: 52em)',
421+
])
422+
expect(result).toEqual({
423+
width: '100%',
424+
color: 'red',
425+
'@media screen and (min-width: 40em)': {
426+
color: 'green',
427+
},
428+
'@media screen and (min-width: 52em)': {
429+
width: '50%',
430+
color: 'blue',
431+
},
407432
})
408433
})

0 commit comments

Comments
 (0)