Index: LayoutTests/css3/device-adapt/viewport-delete-rule.html |
diff --git a/LayoutTests/css3/device-adapt/viewport-delete-rule.html b/LayoutTests/css3/device-adapt/viewport-delete-rule.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0013233fcb568c626a4858beba503f809515123f |
--- /dev/null |
+++ b/LayoutTests/css3/device-adapt/viewport-delete-rule.html |
@@ -0,0 +1,45 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+ <title>Insert and delete @viewport rule</title> |
+ <script src="../../resources/testharness.js"></script> |
+ <script src="../../resources/testharnessreport.js"></script> |
+ <style> |
+ html { width: 100%; height: 100%; } |
+ </style> |
+ <script> |
+ if (window.testRunner) { |
+ testRunner.enableFixedLayoutMode(true); |
+ internals.settings.setViewportEnabled(true); |
+ } |
+ |
+ var t1 = async_test("Check that added @viewport rule is applied."); |
+ var t2 = async_test("Check that @viewport rule is not applied after removal."); |
kenneth.r.christiansen
2013/08/21 08:28:35
Great to have this tested
|
+ |
+ onload = function(){ |
+ |
+ var origWidth = document.documentElement.offsetWidth; |
+ var origHeight = document.documentElement.offsetHeight; |
+ |
+ document.styleSheets[0].insertRule("@viewport { width: 400px; height: 400px; }", 0); |
+ |
+ t1.step(function(){ |
+ assert_equals(document.documentElement.offsetWidth, 400, "Width is 400px."); |
+ assert_equals(document.documentElement.offsetHeight, 400, "Height is 400px."); |
+ }); |
+ t1.done(); |
+ |
+ document.styleSheets[0].deleteRule(0); |
+ |
+ t2.step(function(){ |
+ assert_equals(document.documentElement.offsetWidth, origWidth, "Width is default width."); |
+ assert_equals(document.documentElement.offsetHeight, origHeight, "Height is default height."); |
+ }); |
+ t2.done(); |
+ }; |
+ </script> |
+</head> |
+<body> |
+ <div id="log"></div> |
+</body> |
+</html> |