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

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: Renamed addParsedProperty to addRespectingCascade 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
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>
« no previous file with comments | « no previous file | LayoutTests/fast/css/important-js-override-expected.txt » ('j') | Source/core/css/StylePropertySet.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698