add line-height to unitless css props, test cases
Cheng Lou committed
Sep 30, 2013 at 13:54 UTC
27ee9c6eb07fd2f65afb69645d6496811e588346
2 files changed
+16
src/dom/CSSProperty.js
+1
@@ -24,6 +24,7 @@
24
var isUnitlessNumber = {
25
fillOpacity: true,
26
fontWeight: true,
27
+ lineHeight: true,
28
opacity: true,
29
orphans: true,
30
zIndex: true,
src/dom/__tests__/CSSPropertyOperations-test.js
+15
@@ -68,6 +68,21 @@ describe('CSSPropertyOperations', function() {
68
})).toBe('left:0;margin:16px;opacity:0.5;padding:4px;');
69
});
70
71
+ it('should not append `px` to styles that might need a number', function() {
72
+ expect(CSSPropertyOperations.createMarkupForStyles({
73
+ fillOpacity: 1,
74
+ fontWeight: 2,
75
+ opacity: 3,
76
+ orphans: 4,
77
+ zIndex: 5,
78
+ zoom: 6,
79
+ lineHeight: 7
80
+ })).toBe(
81
+ 'fill-opacity:1;font-weight:2;opacity:3;orphans:4;z-index:5;zoom:6;' +
82
+ 'line-height:7;'
83
+ );
84
+ });
85
+
86
it('should set style attribute when styles exist', function() {
87
var styles = {
88
backgroundColor: '#000',