Skip to content

Commit dc2e868

Browse files
authored
Merge pull request #43 from Justineo/master
Fix #42
2 parents 20e7b1c + ca1da6f commit dc2e868

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/__tests__/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ test(
5656
'100%'
5757
)
5858

59+
test(
60+
'should reduce simple calc (7)',
61+
testFixture,
62+
'calc(100px + (100px - 100%))',
63+
'calc(200px - 100%)'
64+
)
65+
5966
test(
6067
'should reduce additions and subtractions (1)',
6168
testFixture,

src/lib/reducer.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ function reduceAddSubExpression(node, precision) {
124124
right: right.left
125125
}, precision)
126126
node.right = right.right
127-
128-
if (node.operator === '-') {
129-
node.operator = right.operator === '+' ? '-' : '+'
130-
}
131-
127+
node.operator = op === '-' ? flip(right.operator) : right.operator
132128
return reduce(node, precision)
133129
}
134130
// value + (something + value) => (value + value) + something

0 commit comments

Comments
 (0)