Refactor unit test
Andrew Davey committed
Jan 10, 2014 at 11:03 UTC
b70c3ef4bb8e25fe93bc3e173b6fd3a924a049ba
1 file changed
+20
-17
src/dom/__tests__/CSSPropertyOperations-test.js
+20
-17
@@ -69,23 +69,26 @@ describe('CSSPropertyOperations', function() {
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
- widows: 8,
81
- volume: 9,
82
- stress: 10,
83
- pitchRange: 11,
84
- richness: 12
85
- })).toBe(
86
- 'fill-opacity:1;font-weight:2;opacity:3;orphans:4;z-index:5;zoom:6;' +
87
- 'line-height:7;widows:8;volume:9;stress:10;pitch-range:11;richness:12;'
88
- );
72
+ var unitlessProperties = [
73
+ 'fillOpacity',
74
+ 'fontWeight',
75
+ 'lineHeight',
76
+ 'opacity',
77
+ 'orphans',
78
+ 'pitchRange',
79
+ 'richness',
80
+ 'stress',
81
+ 'volume',
82
+ 'widows',
83
+ 'zIndex',
84
+ 'zoom'
85
+ ];
86
+ unitlessProperties.forEach(function(property) {
87
+ var styles = {};
88
+ styles[property] = 1;
89
+ expect(CSSPropertyOperations.createMarkupForStyles(styles))
90
+ .toMatch(/:1;$/);
91
+ });
92
});
93
94
it('should set style attribute when styles exist', function() {