diff --git a/src/dom/CSSProperty.js b/src/dom/CSSProperty.js index 78828aa606..693f3d2dd5 100644 --- a/src/dom/CSSProperty.js +++ b/src/dom/CSSProperty.js @@ -24,6 +24,7 @@ var isUnitlessNumber = { fillOpacity: true, fontWeight: true, + lineHeight: true, opacity: true, orphans: true, zIndex: true, diff --git a/src/dom/__tests__/CSSPropertyOperations-test.js b/src/dom/__tests__/CSSPropertyOperations-test.js index 2164c38e9f..c0bb139e8f 100644 --- a/src/dom/__tests__/CSSPropertyOperations-test.js +++ b/src/dom/__tests__/CSSPropertyOperations-test.js @@ -68,6 +68,21 @@ describe('CSSPropertyOperations', function() { })).toBe('left:0;margin:16px;opacity:0.5;padding:4px;'); }); + it('should not append `px` to styles that might need a number', function() { + expect(CSSPropertyOperations.createMarkupForStyles({ + fillOpacity: 1, + fontWeight: 2, + opacity: 3, + orphans: 4, + zIndex: 5, + zoom: 6, + lineHeight: 7 + })).toBe( + 'fill-opacity:1;font-weight:2;opacity:3;orphans:4;z-index:5;zoom:6;' + + 'line-height:7;' + ); + }); + it('should set style attribute when styles exist', function() { var styles = { backgroundColor: '#000',