Chromium Code Reviews| 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(test('.test { background: none; }'), '.test { background: none; }' ); | |
| 12 assert_equals(test('.test { background: none; }'), '.test { background: none; }' ); | |
|
Srirama
2016/08/09 13:34:45
Remove this line, this is duplicated.
MuVen
2016/08/09 13:46:47
Done.
| |
| 13 assert_equals(test('.test { background: none; background-color: black;}'), '.tes t { background: none black; }'); | |
| 14 assert_equals(test('.test { background: none; background-color: initial !importa nt;}'), '.test { background-image: none; background-position: initial; backgroun d-size: initial; background-repeat: initial; background-attachment: initial; bac kground-origin: initial; background-clip: initial; background-color: initial !im portant; }'); | |
| 15 assert_equals(test('.test { background: initial; }'), '.test { background: initi al; }'); | |
| 16 assert_equals(test('.test { background: initial; background-color: black; }'), ' .test { background-image: initial; background-position: initial; background-size : initial; background-repeat: initial; background-attachment: initial; backgroun d-origin: initial; background-clip: initial; background-color: black; }'); | |
| 17 assert_equals(test('.test { background: inherit; }'), '.test { background: inher it; }'); | |
| 18 assert_equals(test('.test { background: inherit; background-color: black; }'), ' .test { background-image: inherit; background-position: inherit; background-size : inherit; background-repeat: inherit; background-attachment: inherit; backgroun d-origin: inherit; background-clip: inherit; background-color: black; }'); | |
| 19 assert_equals(test('.test { background: none; background-repeat: repeat-x !impor tant;}'), '.test { background-image: none; background-position: initial; backgro und-size: initial; background-attachment: initial; background-origin: initial; b ackground-clip: initial; background-color: initial; background-repeat: repeat-x !important; }'); | |
| 20 assert_equals(test('.test { background: none; background-repeat: repeat-x;}'), ' .test { background: none repeat-x; }'); | |
| 21 assert_equals(test('.test { background: none; background-position-x: 0%;}'), '.t est { background: none 0%; }'); | |
| 22 assert_equals(test('.test { background: none; background-position: 20% 80%;}'), '.test { background: none 20% 80%; }'); | |
| 23 assert_equals(test('.test { background-position-x: 5%; }'), '.test { background- position-x: 5%; }'); | |
| 24 assert_equals(test('.test { background-position-y: 5%; }'), '.test { background- position-y: 5%; }'); | |
| 25 assert_equals(test('.test { background-position-x: 5%; background-position-y: 10 %; }'), '.test { background-position: 5% 10%; }'); | |
| 26 assert_equals(test('.test { background-position-x: 5%; background-position-y: 10 % !important; }'), '.test { background-position-x: 5%; background-position-y: 10 % !important; }'); | |
| 27 assert_equals(test('.test { background: url(dummy://test.png); }'), '.test { bac kground: url("dummy://test.png"); }'); | |
| 28 assert_equals(test('.test { background: url(dummy://test.png); background-color: black; }'), '.test { background: url("dummy://test.png") black; }'); | |
| 12 | 29 |
| 13 function test(text) { | 30 function test(text) { |
|
Srirama
2016/08/09 13:34:45
may be rename it to "getStyle" or something like t
MuVen
2016/08/09 13:46:47
Done.
| |
| 14 style.textContent = text; | 31 style.textContent = text; |
| 15 return style.sheet.cssRules[0].cssText; | 32 return style.sheet.cssRules[0].cssText; |
| 16 } | 33 } |
| 17 | 34 }); |
| 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> | 35 </script> |
| 39 <script src="../js/resources/js-test-post.js"></script> | |
| 40 </html> | |
| OLD | NEW |