Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: LayoutTests/fast/css/important-js-override.html

Issue 1094003002: CSSStyleDeclaration::setProperty should override important style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fde9393da113a80be4a0a1c53c2e31d3ff7f2ed0 100644
--- a/LayoutTests/fast/css/important-js-override.html
+++ b/LayoutTests/fast/css/important-js-override.html
@@ -1,8 +1,78 @@
-<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>
- 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 with setProperty()");
+
+test(function () {
+ element.style.cssText = '';
+
+ element.style.color = 'red';
+ assert_equals(element.style.getPropertyValue('color'), 'red');
+ assert_equals(element.style.getPropertyPriority('color'), '');
+
+ element.style.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 without setProperty()");
+
+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 an important one with setProperty()");
+
+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 with setProperty()");
+
+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.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 without setProperty()");
+
+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 an important one with setProperty()");
</script>
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698