1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
<!DOCTYPE html>
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test to make sure background-position is parsed correctly.")
var testContainer = document.createElement("div");
document.body.appendChild(testContainer);
testContainer.innerHTML = '<div style="width:500px;height:500px"><div id="test">hello</div></div>';
e = document.getElementById('test');
style = e.style;
computedStyle = window.getComputedStyle(e, null);
style.backgroundImage = "url(resources/diamond.png)";
style.backgroundRepeat = "no-repeat";
debug("background-position with one value");
// Initial test.
shouldBe("computedStyle.backgroundPosition", "'0% 0%'");
style.backgroundPosition = "70%";
// Second value is assuming to be 'center'
shouldBe("style.backgroundPosition", "'70% 50%'");
shouldBe("computedStyle.backgroundPosition", "'70% 50%'");
style.backgroundPosition = "84px";
shouldBe("style.backgroundPosition", "'84px 50%'");
shouldBe("computedStyle.backgroundPosition", "'84px 50%'");
style.backgroundPosition = "left";
shouldBe("style.backgroundPosition", "'0% 50%'");
shouldBe("computedStyle.backgroundPosition", "'0% 50%'");
style.backgroundPosition = "right";
shouldBe("style.backgroundPosition", "'100% 50%'");
shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
style.backgroundPosition = "bottom";
shouldBe("style.backgroundPosition", "'50% 100%'");
shouldBe("computedStyle.backgroundPosition", "'50% 100%'");
style.backgroundPosition = "top";
shouldBe("style.backgroundPosition", "'50% 0%'");
shouldBe("computedStyle.backgroundPosition", "'50% 0%'");
style.backgroundPosition = "center";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
debug("background-position with two values");
style.backgroundPosition = "left bottom";
shouldBe("style.backgroundPosition", "'0% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 100%'");
style.backgroundPosition = "bottom left";
shouldBe("style.backgroundPosition", "'0% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 100%'");
style.backgroundPosition = "100% bottom";
shouldBe("style.backgroundPosition", "'100% 100%'");
shouldBe("computedStyle.backgroundPosition", "'100% 100%'");
style.backgroundPosition = "100% top";
shouldBe("style.backgroundPosition", "'100% 0%'");
shouldBe("computedStyle.backgroundPosition", "'100% 0%'");
style.backgroundPosition = "54px bottom";
shouldBe("style.backgroundPosition", "'54px 100%'");
shouldBe("computedStyle.backgroundPosition", "'54px 100%'");
style.backgroundPosition = "center center";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "5% bottom";
shouldBe("style.backgroundPosition", "'5% 100%'");
shouldBe("computedStyle.backgroundPosition", "'5% 100%'");
style.backgroundPosition = "30pt -20px";
shouldBe("style.backgroundPosition", "'30pt -20px'");
shouldBe("computedStyle.backgroundPosition", "'40px -20px'");
style.backgroundPosition = "right center";
shouldBe("style.backgroundPosition", "'100% 50%'");
shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
style.backgroundPosition = "100% 0";
shouldBe("style.backgroundPosition", "'100% 0px'");
shouldBe("computedStyle.backgroundPosition", "'100% 0px'");
style.backgroundPosition = "center right";
shouldBe("style.backgroundPosition", "'100% 50%'");
shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
style.backgroundPosition = "center 50%";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "center left";
shouldBe("style.backgroundPosition", "'0% 50%'");
shouldBe("computedStyle.backgroundPosition", "'0% 50%'");
style.backgroundPosition = "-20% center";
shouldBe("style.backgroundPosition", "'-20% 50%'");
shouldBe("computedStyle.backgroundPosition", "'-20% 50%'");
style.backgroundPosition = "top right";
shouldBe("style.backgroundPosition", "'100% 0%'");
shouldBe("computedStyle.backgroundPosition", "'100% 0%'");
style.backgroundPosition = "50% center";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
debug("background-position invalid with one or two values, no change expected");
style.backgroundPosition = "5 right";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "0 right";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "0px right";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "top 108px";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "top 100%";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "60 50%";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "hidden";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "hidden solid";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "bottombottom";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "left left";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "left right";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "top top";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "50% left";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "50";
shouldBe("style.backgroundPosition", "'50% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
style.backgroundPosition = "1px+1px";
shouldBe("style.backgroundPosition", "'1px 1px'");
shouldBe("computedStyle.backgroundPosition", "'1px 1px'");
debug("background-position with CSS3 comma separator, one or two values");
style.backgroundImage = "url(resources/diamond.png), url(resources/ring.png)";
style.backgroundRepeat = "no-repeat";
style.backgroundPosition = "50%, 100%";
shouldBe("style.backgroundPosition", "'50% 50%, 100% 50%'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%, 100% 50%'");
style.backgroundPosition = "top, bottom";
shouldBe("style.backgroundPosition", "'50% 0%, 50% 100%'");
shouldBe("computedStyle.backgroundPosition", "'50% 0%, 50% 100%'");
style.backgroundPosition = "right center, 5px bottom";
shouldBe("style.backgroundPosition", "'100% 50%, 5px 100%'");
shouldBe("computedStyle.backgroundPosition", "'100% 50%, 5px 100%'");
style.backgroundPosition = "top left, bottom right";
shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
debug("background-position with CSS3 comma separator, with invalid one or two values, no change expected");
style.backgroundPosition = "0 center, right right";
shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
style.backgroundPosition = "center right, right right";
shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
style.backgroundPosition = "center 20px, solid 20px";
shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
debug("background-position with CSS3 four values");
style.backgroundImage = "url(resources/diamond.png)";
style.backgroundPosition = "left 10px top 15px";
shouldBe("style.backgroundPosition", "'left 10px top 15px'");
shouldBe("computedStyle.backgroundPosition", "'left 10px top 15px'");
style.backgroundPosition = "left 10% top 30%";
shouldBe("style.backgroundPosition", "'left 10% top 30%'");
shouldBe("computedStyle.backgroundPosition", "'left 10% top 30%'");
style.backgroundPosition = "top 10% left 30%";
shouldBe("style.backgroundPosition", "'left 30% top 10%'");
shouldBe("computedStyle.backgroundPosition", "'left 30% top 10%'");
style.backgroundPosition = "right top 15px";
shouldBe("style.backgroundPosition", "'right 0% top 15px'");
shouldBe("computedStyle.backgroundPosition", "'right 0% top 15px'");
style.backgroundPosition = "left 10px center";
shouldBe("style.backgroundPosition", "'left 10px top 50%'");
shouldBe("computedStyle.backgroundPosition", "'left 10px top 50%'");
style.backgroundPosition = "center top 20px";
shouldBe("style.backgroundPosition", "'left 50% top 20px'");
shouldBe("computedStyle.backgroundPosition", "'left 50% top 20px'");
style.backgroundPosition = "top 20px center";
shouldBe("style.backgroundPosition", "'left 50% top 20px'");
shouldBe("computedStyle.backgroundPosition", "'left 50% top 20px'");
style.backgroundPosition = "center left 30px";
shouldBe("style.backgroundPosition", "'left 30px top 50%'");
shouldBe("computedStyle.backgroundPosition", "'left 30px top 50%'");
style.backgroundPosition = "";
shouldBe("style.backgroundPosition", "''");
shouldBe("computedStyle.backgroundPosition", "'0% 0%'");
style.backgroundPosition = "left 20% top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
debug("background-position with CSS3 invalid four values, no change expected");
style.backgroundPosition = "left center top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "0px right top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left center top center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left center top 20%";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center bottom top 20%";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "right bottom top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "right bottom solid";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "20px bottom top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "20px bottom hidden";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "solid dotted bottom top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "top top top top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left 0px right 20%";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left 30% top 20% center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "20px 30% bottom";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "top 0px bottom";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left 0px right";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "top 0px bottom 30px top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left 10px center 15px";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left 10px top center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center right top 20px";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center 10px center 10px";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "top center center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center 10px center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center center 10px";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center 0px left 20%";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "left center top";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center center center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "top left 50% 50%";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
style.backgroundPosition = "center center center center";
shouldBe("style.backgroundPosition", "'left 20% top 0%'");
shouldBe("computedStyle.backgroundPosition", "'left 20% top 0%'");
debug("background-position with CSS3 four values and comma");
style.backgroundImage = "url(resources/diamond.png), url(resources/ring.png)";
style.backgroundPosition = "center, left bottom 20px";
shouldBe("style.backgroundPosition", "'50% 50%, left 0% bottom 20px'");
shouldBe("computedStyle.backgroundPosition", "'50% 50%, left 0% bottom 20px'");
style.backgroundPosition = "right 20px bottom 20px, center left";
shouldBe("style.backgroundPosition", "'right 20px bottom 20px, 0% 50%'");
shouldBe("computedStyle.backgroundPosition", "'right 20px bottom 20px, 0% 50%'");
style.backgroundPosition = "left 10px top 15px, right 20% bottom 20px";
shouldBe("style.backgroundPosition", "'left 10px top 15px, right 20% bottom 20px'");
shouldBe("computedStyle.backgroundPosition", "'left 10px top 15px, right 20% bottom 20px'");
style.backgroundPosition = "left 10% top, top 0px right";
shouldBe("style.backgroundPosition", "'left 10% top 0%, right 0% top 0px'");
shouldBe("computedStyle.backgroundPosition", "'left 10% top 0%, right 0% top 0px'");
style.backgroundPosition = "right top 15px, bottom right 20px";
shouldBe("style.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
shouldBe("computedStyle.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
debug("background-position with invalid CSS3 four values and comma, no change expected");
style.backgroundPosition = "right top 15px, left right 20px";
shouldBe("style.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
shouldBe("computedStyle.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
style.backgroundPosition = "right left 15px, left bottom 20px";
shouldBe("style.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
shouldBe("computedStyle.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
style.backgroundPosition = "solid, left bottom 20px";
shouldBe("style.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
shouldBe("computedStyle.backgroundPosition", "'right 0% top 15px, right 20px bottom 0%'");
debug("background-position inside the background shorthand");
style.background = "top 10% left 30% / 10em gray round fixed border-box";
shouldBe("style.background", "'left 30% top 10% / 10em round fixed border-box border-box gray'");
shouldBe("computedStyle.background", "'rgb(128, 128, 128) none round fixed left 30% top 10% / 160px border-box border-box'");
style.background = "right top 15px / 10em gray round fixed border-box";
shouldBe("style.background", "'right 0% top 15px / 10em round fixed border-box border-box gray'");
shouldBe("computedStyle.background", "'rgb(128, 128, 128) none round fixed right 0% top 15px / 160px border-box border-box'");
style.background = "left 10px center / 10em gray round fixed border-box";
shouldBe("style.background", "'left 10px top 50% / 10em round fixed border-box border-box gray'");
shouldBe("computedStyle.background", "'rgb(128, 128, 128) none round fixed left 10px top 50% / 160px border-box border-box'");
style.background = "left 10px center round fixed border-box";
shouldBe("style.background", "'left 10px top 50% round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 10px top 50% / auto border-box border-box'");
style.background = "center top 20px round fixed border-box";
shouldBe("style.background", "'left 50% top 20px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 50% top 20px / auto border-box border-box'");
style.background = "top 20px center round fixed border-box";
shouldBe("style.background", "'left 50% top 20px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 50% top 20px / auto border-box border-box'");
style.background = "top center round fixed border-box";
shouldBe("style.background", "'50% 0% round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed 50% 0% / auto border-box border-box'");
style.background = "50px 60px / 50px round fixed border-box";
shouldBe("style.background", "'50px 60px / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed 50px 60px / 50px border-box border-box'");
style.background = "50px / 50px round fixed border-box";
shouldBe("style.background", "'50px 50% / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed 50px 50% / 50px border-box border-box'");
style.background = "left top 60px / 50px round fixed border-box";
shouldBe("style.background", "'left 0% top 60px / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 0% top 60px / 50px border-box border-box'");
style.background = "left -20px top 60px / 50px round fixed border-box";
shouldBe("style.background", "'left -20px top 60px / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left -20px top 60px / 50px border-box border-box'");
style.background = "border-box left 20px top / 50px round fixed";
shouldBe("style.background", "'left 20px top 0% / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 20px top 0% / 50px border-box border-box'");
style.background = "border-box round fixed left 20px top / 50px";
shouldBe("style.background", "'left 20px top 0% / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 20px top 0% / 50px border-box border-box'");
style.background = "border-box round fixed left 20px top 40px / 50px";
shouldBe("style.background", "'left 20px top 40px / 50px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 20px top 40px / 50px border-box border-box'");
style.background = "border-box round fixed left 20px top 40px";
shouldBe("style.background", "'left 20px top 40px round fixed border-box border-box'");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none round fixed left 20px top 40px / auto border-box border-box'");
style.background = "top 10% left 30% gray round fixed border-box";
shouldBe("style.background", "'left 30% top 10% round fixed border-box border-box gray'");
shouldBe("computedStyle.background", "'rgb(128, 128, 128) none round fixed left 30% top 10% / auto border-box border-box'");
debug("background-position inside the background shorthand, some invalid cases, no changes expected");
style.background = "";
style.background = "top 10% left 30% 50% gray round fixed border-box";
shouldBe("style.background", "''");
// This is the default computed style.
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "top 10% solid 30% gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "top 10% left round gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "top 10% top 30% gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "center center center / 10em gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "center center 30px / 10em gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "top center left / 10em gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "50% left / 10em gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "solid / 10em gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "top 10% left 20px 50% 50px gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "20px 20px 30px / 40px gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "20px 20px 30px 60px / 40px gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "20px 20px 30px 60px 70px / 40px gray round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
style.background = "20px 20px 30px / 40px gray top left round fixed border-box";
shouldBe("style.background", "''");
shouldBe("computedStyle.background", "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box'");
document.body.removeChild(testContainer);
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
|