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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model.html

Issue 1405293012: [Variables] Enable get/setProperty and similar APIs from the CSSOM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use static_assert. Created 5 years, 1 month 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 | third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model.html b/third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model.html
new file mode 100644
index 0000000000000000000000000000000000000000..ab4ea32a03d842762c649066f681afdfaa50aac5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<style>
+#test {
+ --important:green!important;
+ --not-important:red;
+ color:var(--important);
+}
+#test2 {
+ --variable:value;
+}
+</style>
+<div id="test"></div>
+<script src="../../../resources/js-test.js"></script>
+<script>
+var style = document.styleSheets[0].rules[0].style;
+shouldBeEqualToString('style.getPropertyValue("--important")', "green");
+shouldBeEqualToString('style.getPropertyValue("--not-important")', "red");
+shouldBeEqualToString('style.getPropertyValue("color")', "var(--important)");
+shouldBeEqualToString('style.getPropertyPriority("--important")', "important");
+shouldBeEqualToString('style.getPropertyPriority("--not-important")', "");
+style.setProperty("--foo", "papayawhip");
+style.setProperty("--important-foo", "navajowhite", "important");
+shouldBeEqualToString('style.getPropertyValue("--foo")', "papayawhip");
+shouldBeEqualToString('style.getPropertyPriority("--foo")', "");
+shouldBeEqualToString('style.getPropertyPriority("--important-foo")', "important");
+style.setProperty("--important-foo", "")
+shouldBeEqualToString('style.getPropertyValue("--important-foo")', "");
+shouldBeEqualToString('style.removeProperty("--foo")', "papayawhip");
+shouldBeEqualToString('style.getPropertyValue("--foo")', "");
+
+var computedStyle = window.getComputedStyle(document.getElementById("test"));
+shouldThrow('computedStyle.setProperty("--error", "")',
+ '"NoModificationAllowedError: Failed to execute \'setProperty\' on \'CSSStyleDeclaration\': These styles are computed, and therefore the \'--error\' property is read-only."');
+
+var cssText = document.styleSheets[0].rules[1].cssText;
+shouldBeEqualToString('cssText', '#test2 { --variable: value; }')
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/variables/custom-properties-in-object-model-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698