Chromium Code Reviews| Index: LayoutTests/fast/css/important-js-override.html |
| diff --git a/LayoutTests/fast/css/important-js-override.html b/LayoutTests/fast/css/important-js-override.html |
| index f320bb2e49d6504ab6964878315a9003efecde93..01c75d8b22bceba5f83bde529faed806f151228c 100644 |
| --- a/LayoutTests/fast/css/important-js-override.html |
| +++ b/LayoutTests/fast/css/important-js-override.html |
| @@ -1,8 +1,54 @@ |
| -<div id="a" style="background-color: green !important">The background of this element should be green. It is </div> |
| +<!DOCTYPE html> |
| +<div id="element"></div> |
| + |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| <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.
|
| - if (window.testRunner) |
| - testRunner.dumpAsText(); |
| - var a = document.getElementById("a"); |
| - a.style.backgroundColor = "red"; |
| - a.innerHTML += a.style.backgroundColor; |
| +test(function () { |
| + element.style.cssText = ''; |
| + |
| + element.style.setProperty('color', 'red'); |
| + assert_equals(element.style.getPropertyValue('color'), 'red'); |
| + assert_equals(element.style.getPropertyPriority('color'), ''); |
| + |
| + element.style.setProperty('color', 'green'); |
| + assert_equals(element.style.getPropertyValue('color'), 'green'); |
| + assert_equals(element.style.getPropertyPriority('color'), ''); |
| +}, "Check that a non-important inline style can be replaced by a non-important one"); |
| + |
| +test(function () { |
| + element.style.cssText = ''; |
| + |
| + element.style.setProperty('color', 'red'); |
| + assert_equals(element.style.getPropertyValue('color'), 'red'); |
| + assert_equals(element.style.getPropertyPriority('color'), ''); |
| + |
| + element.style.setProperty('color', 'green', 'important'); |
| + assert_equals(element.style.getPropertyValue('color'), 'green'); |
| + assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| +}, "Check that a non-important inline style can be replaced by a important one"); |
| + |
| +test(function () { |
| + element.style.cssText = ''; |
| + |
| + element.style.setProperty('color', 'red', 'important'); |
| + assert_equals(element.style.getPropertyValue('color'), 'red'); |
| + assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| + |
| + element.style.setProperty('color', 'green'); |
| + assert_equals(element.style.getPropertyValue('color'), 'green'); |
| + assert_equals(element.style.getPropertyPriority('color'), ''); |
| +}, "Check that a important inline style can be replaced by a non-important one"); |
| + |
| +test(function () { |
| + element.style.cssText = ''; |
| + |
| + element.style.setProperty('color', 'red', 'important'); |
| + assert_equals(element.style.getPropertyValue('color'), 'red'); |
| + assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| + |
| + element.style.setProperty('color', 'green', 'important'); |
| + assert_equals(element.style.getPropertyValue('color'), 'green'); |
| + assert_equals(element.style.getPropertyPriority('color'), 'important'); |
| +}, "Check that an important inline style can be replaced by a important one"); |
| </script> |