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

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

mercurial