0
|
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 jQuery.noConflict();
|
|
26
|
|
27 asyncTest( "iFrame change page", function() {
|
|
28
|
|
29 var callbackCounter = 0;
|
|
30
|
|
31 jQuery('iframe').iFrameResize({
|
|
32 log:true,
|
|
33 resizedCallback:function(messageData){
|
|
34 switch (''+(++callbackCounter)){
|
|
35 case '1':
|
|
36 document.getElementsByTagName('iframe')[0].contentWindow.postMessage( msgId + 'pageChange', '*' );
|
|
37 break;
|
|
38 case '2':
|
|
39 ok( 'init' === messageData.type, 'Received '+messageData.type+' message back from iFrame. Expected init');
|
|
40 start();
|
|
41 }
|
|
42 }
|
|
43 });
|
|
44 });
|
|
45
|
|
46
|
|
47 </script>
|
|
48 </body>
|
|
49 </html> |