Permalink
Browse files

Merge pull request #7 from facebook/viewport

Adding viewport test.
  • Loading branch information...
2 parents 2be4023 + ae91951 commit bc0385c6687cc5bfd183d400ce3e49c9d3504c24 @darobin darobin committed Jun 8, 2012
Showing with 54 additions and 0 deletions.
  1. +4 −0 tests/viewport/config.yml
  2. +1 −0 tests/viewport/fixture.html
  3. +21 −0 tests/viewport/iframe.html
  4. +28 −0 tests/viewport/test.js
@@ -0,0 +1,4 @@
+---
+ r: 0
+ spec: "http://www.w3.org/TR/mwabp/#bp-viewport"
+ title: "Viewport"
@@ -0,0 +1 @@
+<!-- <iframe id="viewport" src="/tests/viewport/iframe.html"></iframe> -->
View
@@ -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
@@ -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"
+ // );
+});

0 comments on commit bc0385c

Please sign in to comment.