diff --git a/lib/util.js b/lib/util.js index cb568e3..a2d6cab 100644 --- a/lib/util.js +++ b/lib/util.js @@ -102,7 +102,7 @@ module.exports = { complement: function (value) { var state = this.saveTokens(value) state.value = state.value.replace(REGEX_COMPLEMENT, function (num) { - return REGEX_TOKEN_REPLACEMENT.test(num) ? num.replace(REGEX_TOKEN_REPLACEMENT, function (m) { return '(100%-' + m + ')' }) : 100 - parseFloat(num, 10) + return REGEX_TOKEN_REPLACEMENT.test(num) ? num.replace(REGEX_TOKEN_REPLACEMENT, function (m) { return '(100% - ' + m + ')' }) : 100 - parseFloat(num, 10) }) return this.restoreTokens(state) }, diff --git a/test/data/background-position.js b/test/data/background-position.js index 7807e0a..e7f04c7 100644 --- a/test/data/background-position.js +++ b/test/data/background-position.js @@ -7,7 +7,7 @@ module.exports = [ }, { 'should': 'Should complement percentage horizontal position with calc', - 'expected': 'div {background-position:calc(100%-(30% + 50px)) 75%;}', + 'expected': 'div {background-position:calc(100% - (30% + 50px)) 75%;}', 'input': 'div {background-position:calc(30% + 50px) 75%;}', 'reversable': false }, @@ -19,7 +19,7 @@ module.exports = [ }, { 'should': 'Should complement percentage horizontal position with calc', - 'expected': 'div {background-position:calc(100%-(30% + 50px)) calc(30% + 50px), 10.75% top;}', + 'expected': 'div {background-position:calc(100% - (30% + 50px)) calc(30% + 50px), 10.75% top;}', 'input': 'div {background-position:calc(30% + 50px) calc(30% + 50px), 89.25% top;}', 'reversable': false }, @@ -49,7 +49,7 @@ module.exports = [ }, { 'should': 'Should complement percentage with calc: position-x', - 'expected': 'div {background-position-x:calc(100%-(30% + 50px)), -webkit-calc(100%-(30% + 50px));}', + 'expected': 'div {background-position-x:calc(100% - (30% + 50px)), -webkit-calc(100% - (30% + 50px));}', 'input': 'div {background-position-x:calc(30% + 50px), -webkit-calc(30% + 50px);}', 'reversable': false }, diff --git a/test/data/background.js b/test/data/background.js index 28bf4a9..8c205e0 100644 --- a/test/data/background.js +++ b/test/data/background.js @@ -13,7 +13,7 @@ module.exports = [ }, { 'should': 'Should complement calc horizontal position', - 'expected': '.banner { background: calc(100%-(19% + 2px)) top url(topbanner.png) #00D repeat-y fixed; }', + 'expected': '.banner { background: calc(100% - (19% + 2px)) top url(topbanner.png) #00D repeat-y fixed; }', 'input': '.banner { background: calc(19% + 2px) top url(topbanner.png) #00D repeat-y fixed; }', 'reversable': false }, diff --git a/test/data/transform-origin.js b/test/data/transform-origin.js index 533ec17..5aad5ed 100644 --- a/test/data/transform-origin.js +++ b/test/data/transform-origin.js @@ -13,7 +13,7 @@ module.exports = [ }, { 'should': 'Should mirror calc (x-offset)', - 'expected': 'div { transform-origin: -moz-calc(100%-(((25%/2) * 10px))); }', + 'expected': 'div { transform-origin: -moz-calc(100% - (((25%/2) * 10px))); }', 'input': 'div { transform-origin: -moz-calc(((25%/2) * 10px)); }', 'reversable': false }, @@ -49,7 +49,7 @@ module.exports = [ }, { 'should': 'Should mirror with x being calc (x-offset y-offset)', - 'expected': 'div { transform-origin: -webkit-calc(100%-(15% * (3/2))) 30.25%; }', + 'expected': 'div { transform-origin: -webkit-calc(100% - (15% * (3/2))) 30.25%; }', 'input': 'div { transform-origin: -webkit-calc(15% * (3/2)) 30.25%; }', 'reversable': false }, @@ -91,7 +91,7 @@ module.exports = [ }, { 'should': 'Should not mirror with x being calc (y-offset-keyword x-offset)', - 'expected': 'div { transform-origin:top calc(100%-(((140%/2)))); }', + 'expected': 'div { transform-origin:top calc(100% - (((140%/2)))); }', 'input': 'div { transform-origin:top calc(((140%/2))); }', 'reversable': false }, @@ -115,7 +115,7 @@ module.exports = [ }, { 'should': 'Should mirror with x being calc (x-offset y-offset z-offset)', - 'expected': 'div { transform-origin: calc(100%-(25% * 3 + 20px)) 30% 10%; }', + 'expected': 'div { transform-origin: calc(100% - (25% * 3 + 20px)) 30% 10%; }', 'input': 'div { transform-origin: calc(25% * 3 + 20px) 30% 10%; }', 'reversable': false },