Skip to content

Commit

Permalink
Merge pull request #52 from lsiu/pr-47
Browse files Browse the repository at this point in the history
An alternative fix for PR#47 - Add support for numeric values passed to ‘border-spacing’, e.g. ‘border-spacing: 0’
  • Loading branch information
jsakas authored Jul 10, 2018
2 parents a8c2467 + 597cc7a commit 4f82876
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/properties/borderSpacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ var parse = function parse(v) {
if (v === '' || v === null) {
return undefined;
}
if (v === 0) {
return "0px";
}
if (v.toLowerCase() === 'inherit') {
return v;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,12 @@ module.exports = {
style.flexDirection = 'row';
test.equal(style.cssText, 'flex-direction: row;', 'flex-direction is not column');
test.done();
},
'Support non string entries in border-spacing': function (test) {
var style = new cssstyle.CSSStyleDeclaration();
test.expect(1);
style.borderSpacing = 0;
test.equal(style.cssText, 'border-spacing: 0px;', 'border-spacing is not 0');
test.done();
}
};

0 comments on commit 4f82876

Please sign in to comment.