test_meta_viewport2.html (1501B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>meta viewport test</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 <meta name="viewport" content="width=device-width"> 9 <script src="viewport_helpers.js"></script> 10 </head> 11 <body> 12 <p>width=device-width</p> 13 <script type="application/javascript"> 14 "use strict"; 15 16 add_task(async function test1() { 17 await SpecialPowers.pushPrefEnv(scaleRatio(1.0)); 18 19 let info = getViewportInfo(800, 480); 20 is(info.defaultZoom, 1, "initial zoom is 100%"); 21 is(info.width, 800, "width is the same as the displayWidth"); 22 is(info.height, 480, "height is the same as the displayHeight"); 23 is(info.autoSize, true, "width=device-width enables autoSize"); 24 is(info.allowZoom, true, "zooming is enabled by default"); 25 26 info = getViewportInfo(900, 600); 27 is(info.width, 900, "changing the displayWidth changes the width"); 28 is(info.height, 600, "changing the displayHeight changes the height"); 29 }); 30 31 add_task(async function test2() { 32 await SpecialPowers.pushPrefEnv(scaleRatio(1.5)); 33 34 let info = getViewportInfo(900, 600); 35 is(info.defaultZoom, 1.5, "initial zoom is 150%"); 36 is(info.width, 600, "width equals displayWidth/1.5"); 37 is(info.height, 400, "height equals displayHeight/1.5"); 38 }); 39 </script> 40 </body> 41 </html>