cssstyle 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/.travis.yml +5 -1
- package/lib/CSSStyleDeclaration.js +1 -1
- package/lib/implementedProperties.js +1 -1
- package/lib/named_colors.json +3 -1
- package/lib/properties/margin.js +1 -1
- package/lib/properties/padding.js +1 -1
- package/lib/properties.js +1 -1
- package/package.json +3 -15
- package/scripts/download_latest_properties.js +1 -1
- package/scripts/generate_implemented_properties.js +9 -9
- package/scripts/generate_properties.js +17 -17
- package/tests/tests.js +43 -39
package/.eslintrc.js
CHANGED
package/.travis.yml
CHANGED
|
@@ -198,7 +198,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, {
|
|
|
198
198
|
this.setProperty(
|
|
199
199
|
dummyRule[i],
|
|
200
200
|
dummyRule.getPropertyValue(name),
|
|
201
|
-
dummyRule.getPropertyPriority(name)
|
|
201
|
+
dummyRule.getPropertyPriority(name)
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
204
|
this._onChange(this.cssText);
|
package/lib/named_colors.json
CHANGED
package/lib/properties/margin.js
CHANGED
package/lib/properties.js
CHANGED
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"CSSStyleDeclaration",
|
|
7
7
|
"StyleSheet"
|
|
8
8
|
],
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.4.0",
|
|
10
10
|
"homepage": "https://github.com/jsakas/CSSStyleDeclaration",
|
|
11
11
|
"maintainers": [
|
|
12
12
|
{
|
|
@@ -26,18 +26,6 @@
|
|
|
26
26
|
"email": "fatfisz@gmail.com",
|
|
27
27
|
"url": "https://fatfisz.com"
|
|
28
28
|
},
|
|
29
|
-
{
|
|
30
|
-
"name": "Sampo Kivistö",
|
|
31
|
-
"email": "sampo.kivisto@live.fi"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "Benny Powers",
|
|
35
|
-
"email": "web@bennypowers.com"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "step-off",
|
|
39
|
-
"email": "stepanoff@skbkontur.ru"
|
|
40
|
-
},
|
|
41
29
|
{
|
|
42
30
|
"name": "Nikita Vasilyev",
|
|
43
31
|
"email": "me@elv1s.ru"
|
|
@@ -77,8 +65,8 @@
|
|
|
77
65
|
"generate": "run-p generate:*",
|
|
78
66
|
"generate:implemented_properties": "node ./scripts/generate_implemented_properties.js",
|
|
79
67
|
"generate:properties": "node ./scripts/generate_properties.js",
|
|
80
|
-
"lint": "npm run generate && eslint .",
|
|
81
|
-
"lint:fix": "eslint . --fix",
|
|
68
|
+
"lint": "npm run generate && eslint . --max-warnings 0",
|
|
69
|
+
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
82
70
|
"prepublishOnly": "npm run test-ci",
|
|
83
71
|
"test": "npm run generate && nodeunit tests",
|
|
84
72
|
"test-ci": "npm run lint && npm run test"
|
|
@@ -64,7 +64,7 @@ request(url, function(error, response, body) {
|
|
|
64
64
|
out_file.write(
|
|
65
65
|
"'use strict';\n\n// autogenerated - " +
|
|
66
66
|
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
|
67
|
-
'\n\n'
|
|
67
|
+
'\n\n'
|
|
68
68
|
);
|
|
69
69
|
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
|
70
70
|
|
|
@@ -18,7 +18,7 @@ var date_today = new Date();
|
|
|
18
18
|
out_file.write(
|
|
19
19
|
"'use strict';\n\n// autogenerated - " +
|
|
20
20
|
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
|
21
|
-
'\n\n'
|
|
21
|
+
'\n\n'
|
|
22
22
|
);
|
|
23
23
|
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
|
24
24
|
|
|
@@ -27,9 +27,9 @@ statements.push(
|
|
|
27
27
|
t.variableDeclaration('var', [
|
|
28
28
|
t.variableDeclarator(
|
|
29
29
|
t.identifier('implementedProperties'),
|
|
30
|
-
t.newExpression(t.identifier('Set'), [])
|
|
30
|
+
t.newExpression(t.identifier('Set'), [])
|
|
31
31
|
),
|
|
32
|
-
])
|
|
32
|
+
])
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
dashedProperties.forEach(property => {
|
|
@@ -37,9 +37,9 @@ dashedProperties.forEach(property => {
|
|
|
37
37
|
t.expressionStatement(
|
|
38
38
|
t.callExpression(
|
|
39
39
|
t.memberExpression(t.identifier('implementedProperties'), t.identifier('add')),
|
|
40
|
-
[t.stringLiteral(property)]
|
|
41
|
-
)
|
|
42
|
-
)
|
|
40
|
+
[t.stringLiteral(property)]
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
43
|
);
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -48,9 +48,9 @@ statements.push(
|
|
|
48
48
|
t.assignmentExpression(
|
|
49
49
|
'=',
|
|
50
50
|
t.memberExpression(t.identifier('module'), t.identifier('exports')),
|
|
51
|
-
t.identifier('implementedProperties')
|
|
52
|
-
)
|
|
53
|
-
)
|
|
51
|
+
t.identifier('implementedProperties')
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
out_file.write(generate(t.program(statements)).code + '\n');
|
|
@@ -30,7 +30,7 @@ var date_today = new Date();
|
|
|
30
30
|
out_file.write(
|
|
31
31
|
"'use strict';\n\n// autogenerated - " +
|
|
32
32
|
(date_today.getMonth() + 1 + '/' + date_today.getDate() + '/' + date_today.getFullYear()) +
|
|
33
|
-
'\n\n'
|
|
33
|
+
'\n\n'
|
|
34
34
|
);
|
|
35
35
|
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');
|
|
36
36
|
|
|
@@ -92,7 +92,7 @@ function addFile(filename, dependencyPath) {
|
|
|
92
92
|
dependencyPath
|
|
93
93
|
.slice(dependencyPath.indexOf(filename))
|
|
94
94
|
.concat([filename])
|
|
95
|
-
.join(' -> ')
|
|
95
|
+
.join(' -> ')
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
var file = parsedFilesByPath[filename];
|
|
@@ -119,7 +119,7 @@ var moduleExportsByPath = {};
|
|
|
119
119
|
var statements = [];
|
|
120
120
|
externalDependencies.forEach(function(filename, i) {
|
|
121
121
|
var id = t.identifier(
|
|
122
|
-
'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i
|
|
122
|
+
'external_dependency_' + basename(filename, '.js').replace(/[^A-Za-z]/g, '') + '_' + i
|
|
123
123
|
);
|
|
124
124
|
moduleExportsByPath[filename] = { defaultExports: id };
|
|
125
125
|
var relativePath = path.relative(path.resolve(__dirname + '/../lib'), filename);
|
|
@@ -130,9 +130,9 @@ externalDependencies.forEach(function(filename, i) {
|
|
|
130
130
|
t.variableDeclaration('var', [
|
|
131
131
|
t.variableDeclarator(
|
|
132
132
|
id,
|
|
133
|
-
t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)])
|
|
133
|
+
t.callExpression(t.identifier('require'), [t.stringLiteral(relativePath)])
|
|
134
134
|
),
|
|
135
|
-
])
|
|
135
|
+
])
|
|
136
136
|
);
|
|
137
137
|
});
|
|
138
138
|
function getRequireValue(node, file) {
|
|
@@ -205,7 +205,7 @@ parsedFiles.forEach(function(file) {
|
|
|
205
205
|
path.node.declarations.forEach(function(declaration) {
|
|
206
206
|
path.scope.rename(
|
|
207
207
|
declaration.id.name,
|
|
208
|
-
file.property + '_local_var_' + declaration.id.name
|
|
208
|
+
file.property + '_local_var_' + declaration.id.name
|
|
209
209
|
);
|
|
210
210
|
});
|
|
211
211
|
return;
|
|
@@ -236,7 +236,7 @@ parsedFiles.forEach(function(file) {
|
|
|
236
236
|
var defaultExports = t.objectExpression(
|
|
237
237
|
Object.keys(namedExports).map(function(name) {
|
|
238
238
|
return t.objectProperty(t.identifier(name), namedExports[name]);
|
|
239
|
-
})
|
|
239
|
+
})
|
|
240
240
|
);
|
|
241
241
|
moduleExportsByPath[file.filename] = {
|
|
242
242
|
namedExports: namedExports,
|
|
@@ -247,8 +247,8 @@ parsedFiles.forEach(function(file) {
|
|
|
247
247
|
'var',
|
|
248
248
|
Object.keys(namedExports).map(function(name) {
|
|
249
249
|
return t.variableDeclarator(namedExports[name]);
|
|
250
|
-
})
|
|
251
|
-
)
|
|
250
|
+
})
|
|
251
|
+
)
|
|
252
252
|
);
|
|
253
253
|
statements.push.apply(statements, file.ast.program.body);
|
|
254
254
|
});
|
|
@@ -258,18 +258,18 @@ parsedFiles.forEach(function(file) {
|
|
|
258
258
|
propertyDefinitions.push(
|
|
259
259
|
t.objectProperty(
|
|
260
260
|
t.identifier(file.property),
|
|
261
|
-
t.identifier(file.property + '_export_definition')
|
|
262
|
-
)
|
|
261
|
+
t.identifier(file.property + '_export_definition')
|
|
262
|
+
)
|
|
263
263
|
);
|
|
264
264
|
if (file.property !== dashed) {
|
|
265
265
|
propertyDefinitions.push(
|
|
266
|
-
t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition'))
|
|
266
|
+
t.objectProperty(t.stringLiteral(dashed), t.identifier(file.property + '_export_definition'))
|
|
267
267
|
);
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
var definePropertiesCall = t.callExpression(
|
|
271
271
|
t.memberExpression(t.identifier('Object'), t.identifier('defineProperties')),
|
|
272
|
-
[t.identifier('prototype'), t.objectExpression(propertyDefinitions)]
|
|
272
|
+
[t.identifier('prototype'), t.objectExpression(propertyDefinitions)]
|
|
273
273
|
);
|
|
274
274
|
statements.push(
|
|
275
275
|
t.expressionStatement(
|
|
@@ -279,10 +279,10 @@ statements.push(
|
|
|
279
279
|
t.functionExpression(
|
|
280
280
|
null,
|
|
281
281
|
[t.identifier('prototype')],
|
|
282
|
-
t.blockStatement([t.expressionStatement(definePropertiesCall)])
|
|
283
|
-
)
|
|
284
|
-
)
|
|
285
|
-
)
|
|
282
|
+
t.blockStatement([t.expressionStatement(definePropertiesCall)])
|
|
283
|
+
)
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
286
|
);
|
|
287
287
|
out_file.write(generate(t.program(statements)).code + '\n');
|
|
288
288
|
out_file.end(function(err) {
|
package/tests/tests.js
CHANGED
|
@@ -9,7 +9,7 @@ var dashedProperties = [
|
|
|
9
9
|
];
|
|
10
10
|
var allowedProperties = dashedProperties.map(dashedToCamelCase);
|
|
11
11
|
var implementedProperties = Array.from(require('../lib/implementedProperties')).map(
|
|
12
|
-
dashedToCamelCase
|
|
12
|
+
dashedToCamelCase
|
|
13
13
|
);
|
|
14
14
|
var invalidProperties = implementedProperties.filter(function(property) {
|
|
15
15
|
return !allowedProperties.includes(property);
|
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
|
22
22
|
invalidProperties.length === 0,
|
|
23
23
|
invalidProperties.length +
|
|
24
24
|
' invalid properties implemented: ' +
|
|
25
|
-
Array.from(invalidProperties).join(', ')
|
|
25
|
+
Array.from(invalidProperties).join(', ')
|
|
26
26
|
);
|
|
27
27
|
test.done();
|
|
28
28
|
},
|
|
@@ -72,14 +72,14 @@ module.exports = {
|
|
|
72
72
|
test.ok(4 === style.length, 'length is not 4');
|
|
73
73
|
test.ok(
|
|
74
74
|
'color: blue; background-color: red; width: 78%; height: 50vh;' === style.cssText,
|
|
75
|
-
'cssText is wrong'
|
|
75
|
+
'cssText is wrong'
|
|
76
76
|
);
|
|
77
77
|
test.ok('blue' === style.getPropertyValue('color'), "getPropertyValue('color') failed");
|
|
78
78
|
test.ok('color' === style.item(0), 'item(0) failed');
|
|
79
79
|
test.ok('background-color' === style[1], 'style[1] failed');
|
|
80
80
|
test.ok(
|
|
81
81
|
'red' === style.backgroundColor,
|
|
82
|
-
'style.backgroundColor failed with "' + style.backgroundColor + '"'
|
|
82
|
+
'style.backgroundColor failed with "' + style.backgroundColor + '"'
|
|
83
83
|
);
|
|
84
84
|
style.cssText = '';
|
|
85
85
|
test.ok('' === style.cssText, 'cssText is not empty');
|
|
@@ -112,11 +112,11 @@ module.exports = {
|
|
|
112
112
|
test.ok('blue' === style.backgroundColor, 'backgroundColor is not blue');
|
|
113
113
|
test.ok(
|
|
114
114
|
'url(http://www.example.com/some_img.jpg)' === style.backgroundImage,
|
|
115
|
-
'backgroundImage is wrong'
|
|
115
|
+
'backgroundImage is wrong'
|
|
116
116
|
);
|
|
117
117
|
test.ok(
|
|
118
118
|
'blue url(http://www.example.com/some_img.jpg)' === style.background,
|
|
119
|
-
'background is different'
|
|
119
|
+
'background is different'
|
|
120
120
|
);
|
|
121
121
|
style.border = '0 solid black';
|
|
122
122
|
test.ok('0px' === style.borderWidth, 'borderWidth is not 0px');
|
|
@@ -163,7 +163,7 @@ module.exports = {
|
|
|
163
163
|
test.ok('0px' === style.borderRightWidth, 'borderRightWidth is not 0px');
|
|
164
164
|
test.ok(
|
|
165
165
|
'border-width: 0px;' === style.cssText,
|
|
166
|
-
'cssText is not "border-width: 0px", "' + style.cssText + '"'
|
|
166
|
+
'cssText is not "border-width: 0px", "' + style.cssText + '"'
|
|
167
167
|
);
|
|
168
168
|
test.done();
|
|
169
169
|
},
|
|
@@ -181,7 +181,7 @@ module.exports = {
|
|
|
181
181
|
test.ok(4 === style.length, 'length is not 4');
|
|
182
182
|
test.ok(
|
|
183
183
|
'top: 0px; left: 0%; right: 5em; bottom: 12pt;' === style.cssText,
|
|
184
|
-
'text is not "top: 0px; left: 0%; right: 5em; bottom: 12pt;"'
|
|
184
|
+
'text is not "top: 0px; left: 0%; right: 5em; bottom: 12pt;"'
|
|
185
185
|
);
|
|
186
186
|
test.done();
|
|
187
187
|
},
|
|
@@ -204,18 +204,18 @@ module.exports = {
|
|
|
204
204
|
style.clip = 'rect(0, 3Em, 2pt, 50%)';
|
|
205
205
|
test.ok(
|
|
206
206
|
'rect(0px, 3em, 2pt, 50%)' === style.clip,
|
|
207
|
-
'clip is not "rect(0px, 3em, 2pt, 50%)", "' + style.clip + '"'
|
|
207
|
+
'clip is not "rect(0px, 3em, 2pt, 50%)", "' + style.clip + '"'
|
|
208
208
|
);
|
|
209
209
|
test.ok(2 === style.length, 'length is not 2');
|
|
210
210
|
test.ok(
|
|
211
211
|
'clear: both; clip: rect(0px, 3em, 2pt, 50%);' === style.cssText,
|
|
212
|
-
'cssText is not "clear: both; clip: rect(0px, 3em, 2pt, 50%);"'
|
|
212
|
+
'cssText is not "clear: both; clip: rect(0px, 3em, 2pt, 50%);"'
|
|
213
213
|
);
|
|
214
214
|
test.done();
|
|
215
215
|
},
|
|
216
216
|
'Test colors': function(test) {
|
|
217
217
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
218
|
-
test.expect(
|
|
218
|
+
test.expect(9);
|
|
219
219
|
style.color = 'rgba(0,0,0,0)';
|
|
220
220
|
test.ok('rgba(0, 0, 0, 0)' === style.color, 'color is not rgba(0, 0, 0, 0)');
|
|
221
221
|
style.color = 'rgba(5%, 10%, 20%, 0.4)';
|
|
@@ -227,12 +227,16 @@ module.exports = {
|
|
|
227
227
|
style.color = 'hsla(0, 1%, 2%, 0.5)';
|
|
228
228
|
test.ok(
|
|
229
229
|
'hsla(0, 1%, 2%, 0.5)' === style.color,
|
|
230
|
-
'color is not hsla(0, 1%, 2%, 0.5) ' + style.color
|
|
230
|
+
'color is not hsla(0, 1%, 2%, 0.5) ' + style.color
|
|
231
231
|
);
|
|
232
232
|
style.color = 'hsl(0, 1%, 2%)';
|
|
233
233
|
test.ok('hsl(0, 1%, 2%)' === style.color, 'color is not hsl(0, 1%, 2%) ' + style.color);
|
|
234
234
|
style.color = 'rebeccapurple';
|
|
235
235
|
test.ok('rebeccapurple' === style.color, 'color is not rebeccapurple ' + style.color);
|
|
236
|
+
style.color = 'transparent';
|
|
237
|
+
test.ok('transparent' === style.color, 'color is not transparent ' + style.color);
|
|
238
|
+
style.color = 'currentcolor';
|
|
239
|
+
test.ok('currentcolor' === style.color, 'color is not currentcolor ' + style.color);
|
|
236
240
|
test.done();
|
|
237
241
|
},
|
|
238
242
|
'Test short hand properties with embedded spaces': function(test) {
|
|
@@ -241,68 +245,68 @@ module.exports = {
|
|
|
241
245
|
style.background = 'rgb(0, 0, 0) url(/something/somewhere.jpg)';
|
|
242
246
|
test.ok(
|
|
243
247
|
'rgb(0, 0, 0)' === style.backgroundColor,
|
|
244
|
-
'backgroundColor is not rgb(0, 0, 0): ' + style.backgroundColor
|
|
248
|
+
'backgroundColor is not rgb(0, 0, 0): ' + style.backgroundColor
|
|
245
249
|
);
|
|
246
250
|
test.ok(
|
|
247
251
|
'url(/something/somewhere.jpg)' === style.backgroundImage,
|
|
248
|
-
'backgroundImage is not url(/something/somewhere.jpg): ' + style.backgroundImage
|
|
252
|
+
'backgroundImage is not url(/something/somewhere.jpg): ' + style.backgroundImage
|
|
249
253
|
);
|
|
250
254
|
test.ok(
|
|
251
255
|
'background: rgb(0, 0, 0) url(/something/somewhere.jpg);' === style.cssText,
|
|
252
|
-
'cssText is not correct: ' + style.cssText
|
|
256
|
+
'cssText is not correct: ' + style.cssText
|
|
253
257
|
);
|
|
254
258
|
style = new cssstyle.CSSStyleDeclaration();
|
|
255
259
|
style.border = ' 1px solid black ';
|
|
256
260
|
test.ok(
|
|
257
261
|
'1px solid black' === style.border,
|
|
258
|
-
'multiple spaces not properly parsed: ' + style.border
|
|
262
|
+
'multiple spaces not properly parsed: ' + style.border
|
|
259
263
|
);
|
|
260
264
|
test.done();
|
|
261
265
|
},
|
|
262
266
|
'Setting shorthand properties to an empty string should clear all dependent properties': function(
|
|
263
|
-
test
|
|
267
|
+
test
|
|
264
268
|
) {
|
|
265
269
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
266
270
|
test.expect(2);
|
|
267
271
|
style.borderWidth = '1px';
|
|
268
272
|
test.ok(
|
|
269
273
|
'border-width: 1px;' === style.cssText,
|
|
270
|
-
'cssText is not "border-width: 1px;": ' + style.cssText
|
|
274
|
+
'cssText is not "border-width: 1px;": ' + style.cssText
|
|
271
275
|
);
|
|
272
276
|
style.border = '';
|
|
273
277
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
274
278
|
test.done();
|
|
275
279
|
},
|
|
276
280
|
'Setting implicit properties to an empty string should clear all dependent properties': function(
|
|
277
|
-
test
|
|
281
|
+
test
|
|
278
282
|
) {
|
|
279
283
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
280
284
|
test.expect(2);
|
|
281
285
|
style.borderTopWidth = '1px';
|
|
282
286
|
test.ok(
|
|
283
287
|
'border-top-width: 1px;' === style.cssText,
|
|
284
|
-
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
288
|
+
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
285
289
|
);
|
|
286
290
|
style.borderWidth = '';
|
|
287
291
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
288
292
|
test.done();
|
|
289
293
|
},
|
|
290
294
|
'Setting a shorthand property, whose shorthands are implicit properties, to an empty string should clear all dependent properties': function(
|
|
291
|
-
test
|
|
295
|
+
test
|
|
292
296
|
) {
|
|
293
297
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
294
298
|
test.expect(4);
|
|
295
299
|
style.borderTopWidth = '1px';
|
|
296
300
|
test.ok(
|
|
297
301
|
'border-top-width: 1px;' === style.cssText,
|
|
298
|
-
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
302
|
+
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
299
303
|
);
|
|
300
304
|
style.border = '';
|
|
301
305
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
302
306
|
style.borderTop = '1px solid black';
|
|
303
307
|
test.ok(
|
|
304
308
|
'border-top: 1px solid black;' === style.cssText,
|
|
305
|
-
'cssText is not "border-top: 1px solid black;": ' + style.cssText
|
|
309
|
+
'cssText is not "border-top: 1px solid black;": ' + style.cssText
|
|
306
310
|
);
|
|
307
311
|
style.border = '';
|
|
308
312
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
@@ -314,21 +318,21 @@ module.exports = {
|
|
|
314
318
|
style.borderTopWidth = '1px';
|
|
315
319
|
test.ok(
|
|
316
320
|
'border-top-width: 1px;' === style.cssText,
|
|
317
|
-
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
321
|
+
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
318
322
|
);
|
|
319
323
|
style.border = 'none';
|
|
320
324
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
321
325
|
style.borderTopWidth = '1px';
|
|
322
326
|
test.ok(
|
|
323
327
|
'border-top-width: 1px;' === style.cssText,
|
|
324
|
-
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
328
|
+
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
325
329
|
);
|
|
326
330
|
style.borderTopStyle = 'none';
|
|
327
331
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
328
332
|
style.borderTopWidth = '1px';
|
|
329
333
|
test.ok(
|
|
330
334
|
'border-top-width: 1px;' === style.cssText,
|
|
331
|
-
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
335
|
+
'cssText is not "border-top-width: 1px;": ' + style.cssText
|
|
332
336
|
);
|
|
333
337
|
style.borderTop = 'none';
|
|
334
338
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
@@ -336,12 +340,12 @@ module.exports = {
|
|
|
336
340
|
style.borderLeftWidth = '1px';
|
|
337
341
|
test.ok(
|
|
338
342
|
'border-top-width: 1px; border-left-width: 1px;' === style.cssText,
|
|
339
|
-
'cssText is not "border-top-width: 1px; border-left-width: 1px;": ' + style.cssText
|
|
343
|
+
'cssText is not "border-top-width: 1px; border-left-width: 1px;": ' + style.cssText
|
|
340
344
|
);
|
|
341
345
|
style.borderTop = 'none';
|
|
342
346
|
test.ok(
|
|
343
347
|
'border-left-width: 1px;' === style.cssText,
|
|
344
|
-
'cssText is not "border-left-width: 1px;": ' + style.cssText
|
|
348
|
+
'cssText is not "border-left-width: 1px;": ' + style.cssText
|
|
345
349
|
);
|
|
346
350
|
test.done();
|
|
347
351
|
},
|
|
@@ -353,25 +357,25 @@ module.exports = {
|
|
|
353
357
|
test.done();
|
|
354
358
|
},
|
|
355
359
|
'Setting values implicit and shorthand properties via cssText and setProperty should propagate to dependent properties': function(
|
|
356
|
-
test
|
|
360
|
+
test
|
|
357
361
|
) {
|
|
358
362
|
var style = new cssstyle.CSSStyleDeclaration();
|
|
359
363
|
test.expect(4);
|
|
360
364
|
style.cssText = 'border: 1px solid black;';
|
|
361
365
|
test.ok(
|
|
362
366
|
'border: 1px solid black;' === style.cssText,
|
|
363
|
-
'cssText is not "border: 1px solid black;": ' + style.cssText
|
|
367
|
+
'cssText is not "border: 1px solid black;": ' + style.cssText
|
|
364
368
|
);
|
|
365
369
|
test.ok(
|
|
366
370
|
'1px solid black' === style.borderTop,
|
|
367
|
-
'borderTop is not "1px solid black": ' + style.borderTop
|
|
371
|
+
'borderTop is not "1px solid black": ' + style.borderTop
|
|
368
372
|
);
|
|
369
373
|
style.border = '';
|
|
370
374
|
test.ok('' === style.cssText, 'cssText is not "": ' + style.cssText);
|
|
371
375
|
style.setProperty('border', '1px solid black');
|
|
372
376
|
test.ok(
|
|
373
377
|
'border: 1px solid black;' === style.cssText,
|
|
374
|
-
'cssText is not "border: 1px solid black;": ' + style.cssText
|
|
378
|
+
'cssText is not "border: 1px solid black;": ' + style.cssText
|
|
375
379
|
);
|
|
376
380
|
test.done();
|
|
377
381
|
},
|
|
@@ -381,7 +385,7 @@ module.exports = {
|
|
|
381
385
|
style.setProperty('opacity', 0.75);
|
|
382
386
|
test.ok(
|
|
383
387
|
'opacity: 0.75;' === style.cssText,
|
|
384
|
-
'cssText is not "opacity: 0.75;": ' + style.cssText
|
|
388
|
+
'cssText is not "opacity: 0.75;": ' + style.cssText
|
|
385
389
|
);
|
|
386
390
|
style.opacity = '0.50';
|
|
387
391
|
test.ok('opacity: 0.5;' === style.cssText, 'cssText is not "opacity: 0.5;": ' + style.cssText);
|
|
@@ -486,17 +490,17 @@ module.exports = {
|
|
|
486
490
|
style.backgroundImage = 'url(http://some/url/here1.png)';
|
|
487
491
|
test.ok(
|
|
488
492
|
'url(http://some/url/here1.png)' === style.backgroundImage,
|
|
489
|
-
"background-image wasn't url(http://some/url/here1.png): " + style.backgroundImage
|
|
493
|
+
"background-image wasn't url(http://some/url/here1.png): " + style.backgroundImage
|
|
490
494
|
);
|
|
491
495
|
style.backgroundImage = "url('http://some/url/here2.png')";
|
|
492
496
|
test.ok(
|
|
493
497
|
'url(http://some/url/here2.png)' === style.backgroundImage,
|
|
494
|
-
"background-image wasn't url(http://some/url/here2.png): " + style.backgroundImage
|
|
498
|
+
"background-image wasn't url(http://some/url/here2.png): " + style.backgroundImage
|
|
495
499
|
);
|
|
496
500
|
style.backgroundImage = 'url("http://some/url/here3.png")';
|
|
497
501
|
test.ok(
|
|
498
502
|
'url(http://some/url/here3.png)' === style.backgroundImage,
|
|
499
|
-
"background-image wasn't url(http://some/url/here3.png): " + style.backgroundImage
|
|
503
|
+
"background-image wasn't url(http://some/url/here3.png): " + style.backgroundImage
|
|
500
504
|
);
|
|
501
505
|
test.done();
|
|
502
506
|
},
|
|
@@ -616,7 +620,7 @@ module.exports = {
|
|
|
616
620
|
test.equal(
|
|
617
621
|
style.getPropertyValue('flex-basis'),
|
|
618
622
|
'auto',
|
|
619
|
-
'flex-basis is not `auto` if flex: none;'
|
|
623
|
+
'flex-basis is not `auto` if flex: none;'
|
|
620
624
|
);
|
|
621
625
|
style.removeProperty('flex');
|
|
622
626
|
style.removeProperty('flex-basis');
|
|
@@ -626,12 +630,12 @@ module.exports = {
|
|
|
626
630
|
test.equal(
|
|
627
631
|
style.getPropertyValue('flex-shrink'),
|
|
628
632
|
'',
|
|
629
|
-
'flex-shrink is not empty if flex: auto;'
|
|
633
|
+
'flex-shrink is not empty if flex: auto;'
|
|
630
634
|
);
|
|
631
635
|
test.equal(
|
|
632
636
|
style.getPropertyValue('flex-basis'),
|
|
633
637
|
'auto',
|
|
634
|
-
'flex-basis is not `auto` if flex: auto;'
|
|
638
|
+
'flex-basis is not `auto` if flex: auto;'
|
|
635
639
|
);
|
|
636
640
|
style.removeProperty('flex');
|
|
637
641
|
|