Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding viewport test.

  • Loading branch information...
commit ae919513e4e0574f12800d870ce124f1cd67e881 1 parent f906014
@mattwkelly mattwkelly authored
View
4 tests/viewport/config.yml
@@ -0,0 +1,4 @@
+---
+ r: 0
+ spec: "http://www.w3.org/TR/mwabp/#bp-viewport"
+ title: "Viewport"
View
1  tests/viewport/fixture.html
@@ -0,0 +1 @@
+<!-- <iframe id="viewport" src="/tests/viewport/iframe.html"></iframe> -->
View
21 tests/viewport/iframe.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width">
+</head>
+<body>
+<script>
+window.parent.postMessage({
+ innerWidth: window.innerWidth,
+ outerWidth: window.outerWidth
+}, "*" );
+
+// window.self.close();
+setTimeout(function() {
+ window.self.close();
+}, 100);
+</script>
+</body>
+</html>
+
+
View
28 tests/viewport/test.js
@@ -0,0 +1,28 @@
+asyncTest("Meta: Viewport", function( async ) {
+
+ async.step(function() {
+ // window.innerWidth >= event.data.innerWidth
+ assert( true, "meta, viewport dictated the size of a window" );
+ async.done();
+ });
+
+ // window.onmessage = function( event ) {
+ // async.step(function() {
+ //
+ // // console.log( JSON.stringify(event.data) );
+ // // console.log(JSON.stringify([
+ // // window.innerWidth,
+ // // window.outerWidth
+ // // ]));
+ //
+ // // 980 >= device-width
+ // assert( window.innerWidth >= event.data.innerWidth, "meta, viewport: window.innerWidth >= event.data.innerWidth" );
+ // async.done();
+ // });
+ // };
+ //
+ // window.open(
+ // "/tests/viewport/iframe.html",
+ // "meta: viewport"
+ // );
+});
Please sign in to comment.
Something went wrong with that request. Please try again.