comparison iframe-resizer/test/size.html @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ac5f9272033b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>QUnit LoadHide</title>
6 <link rel="stylesheet" href="resources/qunit.css">
7 </head>
8 <body>
9 <div id="qunit"></div>
10 <div id="qunit-fixture">
11
12 <div style="width:400px;">
13 <iframe src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14 </div>
15
16 </div>
17 <script src="resources/qunit.js"></script>
18 <script src="resources/jquery.js"></script>
19 <script src="../js/iframeResizer.min.js"></script>
20 <script>
21
22 'use strict';
23 var msgId = '[iFrameSizerTest]:';
24
25 asyncTest( "iFrame size Event", function() {
26
27 var callbackCounter = 0;
28
29 $('iframe').iFrameResize({
30 log:true,
31 doWidth:true,
32 enablePublicMethods:true,
33 interval:0,
34 resizedCallback:function(messageData){
35 var msgType = 'size';
36
37 switch (''+(++callbackCounter)){
38 case '1':
39 document.getElementsByTagName('iframe')[0].contentWindow.postMessage( msgId + msgType, '*' );
40 break;
41 case '2':
42 ok( msgType === messageData.type, 'Received '+messageData.type+' message back from iFrame. Expected '+msgType);
43 document.getElementsByTagName('iframe')[0].contentWindow.postMessage( msgId + 'size100', '*' );
44 break;
45 case '3':
46 ok( msgType === messageData.type, 'Received '+messageData.type+' message back from iFrame. Expected '+msgType);
47 ok( '100' === messageData.height, 'Height received = 100');
48 //ok( 100 === $('iframe').height(), 'IFrame height = 100'); Works in phaatomJS, but not chrome!
49 document.getElementsByTagName('iframe')[0].contentWindow.postMessage( msgId + 'size200300', '*' );
50 break;
51 case '4':
52 ok( msgType === messageData.type, 'Received '+messageData.type+' message back from iFrame. Expected '+msgType);
53 ok( '200' === messageData.height, 'Height received = 200');
54 ok( '300' === messageData.width, 'Width received = 300');
55 start();
56 }
57 }
58 });
59 });
60
61
62 </script>
63 </body>
64 </html>