content/html/document/test/test_viewport.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE html>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=436083
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
michael@0 8 <meta name="viewport" content="height=398, width=4224, minimum-scale=0.1,
michael@0 9 initial-scale=2.3, maximum-scale=45.2, user-scalable=no">
michael@0 10 <title>Test for Viewport META Tag Parsing</title>
michael@0 11 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 13 </head>
michael@0 14 <body>
michael@0 15 <a target="_blank"
michael@0 16 href="https://bugzilla.mozilla.org/show_bug.cgi?id=436083">Mozilla Bug 436083</a>
michael@0 17 <pre id="test">
michael@0 18 <script class="testbody" type="text/javascript">
michael@0 19
michael@0 20 /** Test for Viewport META Tag **/
michael@0 21
michael@0 22 SimpleTest.waitForExplicitFinish();
michael@0 23
michael@0 24 function testViewport() {
michael@0 25
michael@0 26 /* We need to access the document headers, which are chrome-only. */
michael@0 27
michael@0 28 /* Grab Viewport Metadata from the document header. */
michael@0 29 var windowUtils = SpecialPowers.getDOMWindowUtils(window);
michael@0 30 var vpWidth =
michael@0 31 parseInt(windowUtils.getDocumentMetadata("viewport-width"));
michael@0 32 var vpHeight =
michael@0 33 parseInt(windowUtils.getDocumentMetadata("viewport-height"));
michael@0 34 var vpInitialScale =
michael@0 35 parseFloat(windowUtils.getDocumentMetadata("viewport-initial-scale"));
michael@0 36 var vpMaxScale =
michael@0 37 parseFloat(windowUtils.getDocumentMetadata("viewport-maximum-scale"));
michael@0 38 var vpMinScale =
michael@0 39 parseFloat(windowUtils.getDocumentMetadata("viewport-minimum-scale"));
michael@0 40 var vpUserScalable =
michael@0 41 windowUtils.getDocumentMetadata("viewport-user-scalable");
michael@0 42
michael@0 43 is(vpWidth, 4224, "Should get proper width");
michael@0 44 is(vpHeight, 398, "Should get proper height");
michael@0 45 is(vpInitialScale, 2.3, "Should get proper initial scale");
michael@0 46 is(vpMaxScale, 45.2, "Should get proper max scale");
michael@0 47 is(vpMinScale, 0.1, "Should get proper min scale");
michael@0 48 is(vpUserScalable, "no", "Should get proper user scalable parameter");
michael@0 49 }
michael@0 50
michael@0 51 addLoadEvent(testViewport);
michael@0 52 addLoadEvent(SimpleTest.finish);
michael@0 53
michael@0 54 </script>
michael@0 55 </pre>
michael@0 56 </body>
michael@0 57 </html>

mercurial