Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <div id="a" style="background-color: green !important">The background of this el ement should be green. It is </div> | 1 <!DOCTYPE html> |
| 2 <div id="element"></div> | |
| 3 | |
| 4 <script src="../../resources/testharness.js"></script> | |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 2 <script> | 6 <script> |
|
Timothy Loh
2015/04/24 09:21:27
Should have a test for "element.style.color = gree
sashab
2015/04/26 23:23:41
Done, added 2 more tests.
| |
| 3 if (window.testRunner) | 7 test(function () { |
| 4 testRunner.dumpAsText(); | 8 element.style.cssText = ''; |
| 5 var a = document.getElementById("a"); | 9 |
| 6 a.style.backgroundColor = "red"; | 10 element.style.setProperty('color', 'red'); |
| 7 a.innerHTML += a.style.backgroundColor; | 11 assert_equals(element.style.getPropertyValue('color'), 'red'); |
| 12 assert_equals(element.style.getPropertyPriority('color'), ''); | |
| 13 | |
| 14 element.style.setProperty('color', 'green'); | |
| 15 assert_equals(element.style.getPropertyValue('color'), 'green'); | |
| 16 assert_equals(element.style.getPropertyPriority('color'), ''); | |
| 17 }, "Check that a non-important inline style can be replaced by a non-important o ne"); | |
| 18 | |
| 19 test(function () { | |
| 20 element.style.cssText = ''; | |
| 21 | |
| 22 element.style.setProperty('color', 'red'); | |
| 23 assert_equals(element.style.getPropertyValue('color'), 'red'); | |
| 24 assert_equals(element.style.getPropertyPriority('color'), ''); | |
| 25 | |
| 26 element.style.setProperty('color', 'green', 'important'); | |
| 27 assert_equals(element.style.getPropertyValue('color'), 'green'); | |
| 28 assert_equals(element.style.getPropertyPriority('color'), 'important'); | |
| 29 }, "Check that a non-important inline style can be replaced by a important one") ; | |
| 30 | |
| 31 test(function () { | |
| 32 element.style.cssText = ''; | |
| 33 | |
| 34 element.style.setProperty('color', 'red', 'important'); | |
| 35 assert_equals(element.style.getPropertyValue('color'), 'red'); | |
| 36 assert_equals(element.style.getPropertyPriority('color'), 'important'); | |
| 37 | |
| 38 element.style.setProperty('color', 'green'); | |
| 39 assert_equals(element.style.getPropertyValue('color'), 'green'); | |
| 40 assert_equals(element.style.getPropertyPriority('color'), ''); | |
| 41 }, "Check that a important inline style can be replaced by a non-important one") ; | |
| 42 | |
| 43 test(function () { | |
| 44 element.style.cssText = ''; | |
| 45 | |
| 46 element.style.setProperty('color', 'red', 'important'); | |
| 47 assert_equals(element.style.getPropertyValue('color'), 'red'); | |
| 48 assert_equals(element.style.getPropertyPriority('color'), 'important'); | |
| 49 | |
| 50 element.style.setProperty('color', 'green', 'important'); | |
| 51 assert_equals(element.style.getPropertyValue('color'), 'green'); | |
| 52 assert_equals(element.style.getPropertyPriority('color'), 'important'); | |
| 53 }, "Check that an important inline style can be replaced by a important one"); | |
| 8 </script> | 54 </script> |
| OLD | NEW |