Mercurial > repos > saskia-hiltemann > ireport
comparison iframe-resizer/test/resize.width.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:600px;"> | |
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 function resize(size){ | |
26 console.info('Size width:'+size); | |
27 $('#qunit-fixture > div').width(size); | |
28 } | |
29 | |
30 asyncTest( "iFrame Resize Event", function() { | |
31 | |
32 var callbackCounter = 0; | |
33 | |
34 $('iframe').iFrameResize({ | |
35 log:true, | |
36 interval:1000, | |
37 heightCalculationMethod:'max', | |
38 resizedCallback:function(messageData){ | |
39 | |
40 switch (''+(++callbackCounter)){ | |
41 case '1': | |
42 setTimeout(function(){resize(300);},100); | |
43 break; | |
44 case '2': | |
45 setTimeout(function(){resize(600)},100); | |
46 ok( 'resize' === messageData.type, '1 Received '+messageData.type+' message back from iFrame. Expected resize'); | |
47 ok( '300' === messageData.width, '2 iFrame width = '+messageData.width+'. Expected 300.'); | |
48 break; | |
49 default: | |
50 ok( 'resetPage' === messageData.type, '3 Received '+messageData.type+' message back from iFrame. Expected resetPage'); | |
51 if ('600' === messageData.width){ | |
52 ok( '600' === messageData.width, '4 iFrame width = '+messageData.width+'. Expected 600.'); | |
53 start(); | |
54 } | |
55 } | |
56 } | |
57 }); | |
58 }); | |
59 | |
60 | |
61 </script> | |
62 </body> | |
63 </html> |