Skip to content

Commit

Permalink
Fixes #71
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadYounes committed May 16, 2016
1 parent eeabe94 commit 8ca896a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down
6 changes: 3 additions & 3 deletions test/data/background-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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
},
Expand Down Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
8 changes: 4 additions & 4 deletions test/data/transform-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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
},
Expand All @@ -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
},
Expand Down

0 comments on commit 8ca896a

Please sign in to comment.