-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathstringify-css.test.js
34 lines (26 loc) · 1.08 KB
/
stringify-css.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Dependencies
// =============================================================================
import parseCss from '../src/parse-css';
import stringifyCss from '../src/stringify-css';
import { expect } from 'chai';
// Suite
// =============================================================================
describe('stringify-css', function() {
const fixtures = window.__FIXTURES__;
// Tests
// -------------------------------------------------------------------------
it('converts AST to string', function() {
const cssIn = fixtures['test-parse.css'];
const cssAst = parseCss(cssIn);
const cssOut = stringifyCss(cssAst);
const expectCss = fixtures['test-stringify.css'].replace(/\n/g,'');
expect(cssOut).to.equal(expectCss);
});
it('triggers callback for each node', function() {
const cssIn = 'p { color: red; }';
const cssAst = parseCss(cssIn);
let callbackCount = 0;
stringifyCss(cssAst, '', node => { callbackCount++; });
expect(callbackCount).to.be.above(0);
});
});