OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | |
3 <head> | 2 <head> |
4 <script src="../../resources/js-test.js"></script> | 3 <title>Test background properties obtained by using cssText when the properties
are set by using style element's textContent.</title> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
5 </head> | 6 </head> |
6 <body> | |
7 <pre id='console'></pre> | |
8 </body> | |
9 <script> | 7 <script> |
| 8 test(function() { |
10 var style = document.createElement('style'); | 9 var style = document.createElement('style'); |
11 document.head.appendChild(style); | 10 document.head.appendChild(style); |
| 11 assert_equals(getStyle('.test { background: none; }'), '.test { background: none
; }'); |
| 12 assert_equals(getStyle('.test { background: none; background-color: black;}'), '
.test { background: none black; }'); |
| 13 assert_equals(getStyle('.test { background: none; background-color: initial !imp
ortant;}'), '.test { background-image: none; background-position: initial; backg
round-size: initial; background-repeat: initial; background-attachment: initial;
background-origin: initial; background-clip: initial; background-color: initial
!important; }'); |
| 14 assert_equals(getStyle('.test { background: initial; }'), '.test { background: i
nitial; }'); |
| 15 assert_equals(getStyle('.test { background: initial; background-color: black; }'
), '.test { background-image: initial; background-position: initial; background-
size: initial; background-repeat: initial; background-attachment: initial; backg
round-origin: initial; background-clip: initial; background-color: black; }'); |
| 16 assert_equals(getStyle('.test { background: inherit; }'), '.test { background: i
nherit; }'); |
| 17 assert_equals(getStyle('.test { background: inherit; background-color: black; }'
), '.test { background-image: inherit; background-position: inherit; background-
size: inherit; background-repeat: inherit; background-attachment: inherit; backg
round-origin: inherit; background-clip: inherit; background-color: black; }'); |
| 18 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x !i
mportant;}'), '.test { background-image: none; background-position: initial; bac
kground-size: initial; background-attachment: initial; background-origin: initia
l; background-clip: initial; background-color: initial; background-repeat: repea
t-x !important; }'); |
| 19 assert_equals(getStyle('.test { background: none; background-repeat: repeat-x;}'
), '.test { background: none repeat-x; }'); |
| 20 assert_equals(getStyle('.test { background: none; background-position-x: 0%;}'),
'.test { background: none 0%; }'); |
| 21 assert_equals(getStyle('.test { background: none; background-position: 20% 80%;}
'), '.test { background: none 20% 80%; }'); |
| 22 assert_equals(getStyle('.test { background-position-x: 5%; }'), '.test { backgro
und-position-x: 5%; }'); |
| 23 assert_equals(getStyle('.test { background-position-y: 5%; }'), '.test { backgro
und-position-y: 5%; }'); |
| 24 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10%; }'), '.test { background-position: 5% 10%; }'); |
| 25 assert_equals(getStyle('.test { background-position-x: 5%; background-position-y
: 10% !important; }'), '.test { background-position-x: 5%; background-position-y
: 10% !important; }'); |
| 26 assert_equals(getStyle('.test { background: url(dummy://test.png); }'), '.test {
background: url("dummy://test.png"); }'); |
| 27 assert_equals(getStyle('.test { background: url(dummy://test.png); background-co
lor: black; }'), '.test { background: url("dummy://test.png") black; }'); |
12 | 28 |
13 function test(text) { | 29 function getStyle(text) { |
14 style.textContent = text; | 30 style.textContent = text; |
15 return style.sheet.cssRules[0].cssText; | 31 return style.sheet.cssRules[0].cssText; |
16 } | 32 } |
17 | 33 }); |
18 description("Test background properties obtained by using cssText when the prope
rties are set by using style element's textContent."); | |
19 | |
20 shouldBeEqualToString("test('.test { background: none; }')", ".test { background
: none; }"); | |
21 shouldBeEqualToString("test('.test { background: none; background-color: black;}
')", ".test { background: none black; }"); | |
22 shouldBeEqualToString("test('.test { background: none; background-color: initial
!important;}')", ".test { background-image: none; background-position: initial;
background-size: initial; background-repeat: initial; background-attachment: in
itial; background-origin: initial; background-clip: initial; background-color: i
nitial !important; }"); | |
23 shouldBeEqualToString("test('.test { background: initial; }')", ".test { backgro
und: initial; }"); | |
24 shouldBeEqualToString("test('.test { background: initial; background-color: blac
k; }')", ".test { background-image: initial; background-position: initial; backg
round-size: initial; background-repeat: initial; background-attachment: initial;
background-origin: initial; background-clip: initial; background-color: black;
}"); | |
25 shouldBeEqualToString("test('.test { background: inherit; }')", ".test { backgro
und: inherit; }"); | |
26 shouldBeEqualToString("test('.test { background: inherit; background-color: blac
k; }')", ".test { background-image: inherit; background-position: inherit; backg
round-size: inherit; background-repeat: inherit; background-attachment: inherit;
background-origin: inherit; background-clip: inherit; background-color: black;
}"); | |
27 shouldBeEqualToString("test('.test { background: none; background-repeat: repeat
-x !important;}')", ".test { background-image: none; background-position: initia
l; background-size: initial; background-attachment: initial; background-origin:
initial; background-clip: initial; background-color: initial; background-repeat:
repeat-x !important; }"); | |
28 shouldBeEqualToString("test('.test { background: none; background-repeat: repeat
-x;}')", ".test { background: none repeat-x; }"); | |
29 shouldBeEqualToString("test('.test { background: none; background-position-x: 0%
;}')", ".test { background: none 0%; }"); | |
30 shouldBeEqualToString("test('.test { background: none; background-position: 20%
80%;}')", ".test { background: none 20% 80%; }"); | |
31 shouldBeEqualToString("test('.test { background-position-x: 5%; }')", ".test { b
ackground-position-x: 5%; }"); | |
32 shouldBeEqualToString("test('.test { background-position-y: 5%; }')", ".test { b
ackground-position-y: 5%; }"); | |
33 shouldBeEqualToString("test('.test { background-position-x: 5%; background-posit
ion-y: 10%; }')", ".test { background-position: 5% 10%; }"); | |
34 shouldBeEqualToString("test('.test { background-position-x: 5%; background-posit
ion-y: 10% !important; }')", ".test { background-position-x: 5%; background-posi
tion-y: 10% !important; }"); | |
35 shouldBeEqualToString("test('.test { background: url(dummy://test.png); }')", '.
test { background: url("dummy://test.png"); }'); | |
36 shouldBeEqualToString("test('.test { background: url(dummy://test.png); backgrou
nd-color: black; }')", '.test { background: url("dummy://test.png") black; }'); | |
37 | |
38 </script> | 34 </script> |
39 <script src="../js/resources/js-test-post.js"></script> | |
40 </html> | |
OLD | NEW |