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

Unified Diff: LayoutTests/css3/device-adapt/viewport-cssom-01.html

Issue 22917005: New parser mode for CSSOM @viewport descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comments added. Created 7 years, 3 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/css3/device-adapt/viewport-cssom-01-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/css3/device-adapt/viewport-cssom-01.html
diff --git a/LayoutTests/css3/device-adapt/viewport-cssom-01.html b/LayoutTests/css3/device-adapt/viewport-cssom-01.html
new file mode 100644
index 0000000000000000000000000000000000000000..4cf47a7aa71c4e3a8e7277f12b5e91c7934a6580
--- /dev/null
+++ b/LayoutTests/css3/device-adapt/viewport-cssom-01.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>@viewport CSSOM - set descriptor values</title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.enableFixedLayoutMode(true);
+ internals.settings.setViewportEnabled(true);
+ }
+ </script>
+ <style>
+ @viewport {
+ width: 200px;
+ }
+ </style>
+</head>
+<body>
+ <div id="log"></div>
+ <script>
+ test(function(){
+ assert_equals(document.styleSheets[0].cssRules.length, 1, "Rule is found");
+ assert_equals(document.styleSheets[0].cssRules[0].type, CSSRule.VIEWPORT_RULE, "Rule is of type @viewport");
+ }, "@viewport rule exists");
+
+ var rule = document.styleSheets[0].cssRules[0];
+
+ test(function(){
+ rule.style.width = "400px";
+ assert_equals(rule.style.minWidth, "400px", "min-width is now 400px");
+ }, "Setting width shorthand sets min-width");
+
+ test(function(){
+ rule.style.height = "900px";
+ assert_equals(rule.style.maxHeight, "900px", "max-height is now 900px");
+ }, "Setting height shorthand sets max-height");
+
+ test(function(){
+ rule.style.cssText = "width: 300px; height: 700px";
+ assert_equals(rule.style.minWidth, "300px", "min-width is now 300px");
+ assert_equals(rule.style.maxHeight, "700px", "max-height is now 700px");
+ }, "Setting cssText of ViewportRule.style parses width/height as shorthands");
+
+ test(function(){
+ document.styleSheets[0].insertRule("@viewport { width: 600px; height: 200px }", 0);
+ rule = document.styleSheets[0].cssRules[0];
+ assert_equals(rule.style.minWidth, "600px", "min-width is now 600px");
+ assert_equals(rule.style.maxHeight, "200px", "max-height is now 200px");
+ }, "Inserting @viewport rule parses width/height as shorthands");
+ </script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/css3/device-adapt/viewport-cssom-01-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698