2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-10 07:11:00 +00:00
iconify/packages/utils/tests/format-css-test.ts
2022-11-26 13:24:42 +02:00

75 lines
1.0 KiB
TypeScript

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}`);
});
});