Skip to content

Commit 5b9aa8a

Browse files
committed
test: Add test demonstrating infinite loop.
1 parent b4e9349 commit 5b9aa8a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/__tests__/integration.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import test from 'ava';
2+
import postcss from 'postcss';
3+
4+
import reduceCalc from '../../dist';
5+
6+
const testPlugin = {
7+
postcssPlugin: 'testplugin',
8+
Declaration(decl) {
9+
if (decl.value.startsWith('calc')) {
10+
decl.value = 'calc(50%-0.5rem)'
11+
}
12+
}
13+
}
14+
15+
const processor = postcss([reduceCalc, testPlugin]);
16+
17+
const css = `.item {
18+
align-self: flex-end;
19+
flex-basis: calc((100% - 1rem) / 2);
20+
}`;
21+
22+
test('handles a different plugin changing the same declaration', t => {
23+
t.plan(1);
24+
return processor.process(css, {from: undefined}).then(result => {
25+
t.deepEqual(result.css, `.item {
26+
align-self: flex-end;
27+
flex-basis: calc(50% - 0.5rem);
28+
}`);
29+
});
30+
})

0 commit comments

Comments
 (0)