Browse Source

add exclude option test cases

pull/14/head
msidolphin 7 years ago
committed by GitHub
parent
commit
518a69adba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      spec/px-to-viewport.spec.js

48
spec/px-to-viewport.spec.js

@ -196,3 +196,51 @@ describe('minPixelValue', function () {
expect(processed).toBe(expected);
});
});
describe('exclude', function () {
var rules = '.rule { border: 1px solid #000; font-size: 16px; margin: 1px 10px; }';
var covered = '.rule { border: 1px solid #000; font-size: 5vw; margin: 1px 3.125vw; }'
it('when using regex at the time, the style should not be overwritten.', function () {
var options = {
exclude: /node_modules/
}
var processed = postcss(pxToViewport(options)).process(rules, {
from: '/node_modules/main.css'
}).css;
expect(processed).toBe(rules);
});
it('when using regex at the time, the style should be overwritten.', function () {
var options = {
exclude: /node_modules/
}
var processed = postcss(pxToViewport(options)).process(rules, {
from: '/example/main.css'
}).css;
expect(processed).toBe(covered);
});
it('when using array at the time, the style should not be overwritten.', function () {
var options = {
exclude: [/node_modules/, /exclude/]
}
var processed = postcss(pxToViewport(options)).process(rules, {
from: '/exclude/main.css'
}).css;
expect(processed).toBe(rules);
});
it('when using array at the time, the style should be overwritten.', function () {
var options = {
exclude: [/node_modules/, /exclude/]
}
var processed = postcss(pxToViewport(options)).process(rules, {
from: '/example/main.css'
}).css;
expect(processed).toBe(covered);
});
});
Loading…
Cancel
Save