Skip to content

Commit

Permalink
fix(tests): add more tests for '0 - something' case (postcss#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasminexie committed Oct 1, 2019
1 parent 5338ae3 commit 6774ad8
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ test(
'calc((100vw - 50em)/2)',
);

test(
'should reduce additions and subtractions (5)',
testValue,
'calc(10px - (100vw - 50em) / 2)',
'calc(10px - (100vw - 50em)/2)',
);

test(
'should ignore value surrounding calc function (1)',
testValue,
Expand Down Expand Up @@ -361,12 +368,33 @@ test(
);

test(
'should reduce substracted division expression from zero',
'should reduce substracted expression from zero (1)',
testValue,
'calc( 0 - (100vw - 10px) / 2 )',
'calc((-100vw - -10px)/2)',
);

test(
'should reduce substracted expression from zero (2)',
testValue,
'calc( 0px - (100vw - 10px))',
'calc(-100vw - -10px)',
);

test(
'should reduce substracted expression from zero (3)',
testValue,
'calc( 0px - (100vw - 10px) * 2px )',
'calc((-100vw - -10px)*2px)',
);

test(
'should reduce substracted expression from zero (4)',
testValue,
'calc( 0px - (100vw + 10px))',
'calc(-100vw + -10px)',
);

test(
'should reduce nested expression',
testValue,
Expand Down

0 comments on commit 6774ad8

Please sign in to comment.