Skip to content

Commit

Permalink
Fixed "alwaysUseZeroWithoutUnit" formatting option
Browse files Browse the repository at this point in the history
  • Loading branch information
Anantachai Saothong (Manta) committed Mar 24, 2018
1 parent b06dea0 commit aa07d4a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ function format(content, options = {}) {
outputBuffer.append(inputNode.val)
}

if (!options.alwaysUseZeroWithoutUnit || inputNode.val !== 0) {
if (!options.alwaysUseZeroWithoutUnit || inputNode.val !== 0 || inputNode.type === 's' || inputNode.type === 'ms') {
outputBuffer.append(inputNode.type)
}

Expand Down
3 changes: 2 additions & 1 deletion spec/option-always-use-zero-without-unit-false/input.styl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
body
margin 0px 0em 0% 0
margin 0px 0em 0% 0
transition all 0ms ease-in-out 0s
1 change: 1 addition & 0 deletions spec/option-always-use-zero-without-unit-false/output.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
body {
margin: 0px 0em 0% 0;
transition: all 0ms ease-in-out 0s;
}
3 changes: 2 additions & 1 deletion spec/option-always-use-zero-without-unit-true/input.styl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
body
margin 0px 0em 0% 0
margin 0px 0em 0% 0
transition all 0ms ease-in-out 0s
1 change: 1 addition & 0 deletions spec/option-always-use-zero-without-unit-true/output.styl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
body {
margin: 0 0 0 0;
transition: all 0ms ease-in-out 0s;
}

0 comments on commit aa07d4a

Please sign in to comment.