2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-15 14:50:47 +00:00
iconify/packages/utils/tests/format-css-test.ts

75 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-11-26 11:24:42 +00:00
import { formatCSS } from '../lib/css/format';
describe('Testing formatCSS', () => {
test('Various modes', () => {
expect(
formatCSS(
[
{
selector: '.foo',
rules: {
'color': 'red',
'font-size': '16px',
},
},
{
selector: '.bar',
rules: { color: 'blue' },
},
],
'expanded'
)
).toBe(`.foo {
color: red;
font-size: 16px;
}
.bar {
color: blue;
}
`);
expect(
formatCSS(
[
{
selector: '.foo',
rules: { 'color': 'red', 'font-size': '16px' },
},
{
selector: '.bar',
rules: { color: 'blue' },
},
],
'compact'
)
).toBe(`.foo { color: red; font-size: 16px; }
.bar { color: blue; }
`);
expect(
formatCSS(
[
{
selector: '.foo',
rules: {
'color': 'red',
'font-size': '16px',
},
},
{
selector: '.bar',
rules: {
color: 'blue',
},
},
],
'compressed'
)
).toBe(`.foo{color:red;font-size:16px}.bar{color:blue}`);
});
});