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:600px;">
|
|
13 <iframe src="resources/frame.content.html" height="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="resources/testLib.js"></script>
|
|
20 <script src="../js/iframeResizer.min.js"></script>
|
|
21 <script>
|
|
22
|
|
23 'use strict';
|
|
24 var msgId = '[iFrameSizerTest]:';
|
|
25
|
|
26 var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
|
27
|
|
28 function mutationObserverTest(){
|
|
29 asyncTest( "iFrame late image load", function() {
|
|
30
|
|
31 var callbackCounter = 0;
|
|
32
|
|
33 $('iframe').iFrameResize({
|
|
34 log:true,
|
|
35 sizeHeight:false,
|
|
36 sizeWidth:true,
|
|
37 interval:1,
|
|
38 resizedCallback:function(messageData){
|
|
39 switch (''+(++callbackCounter)){
|
|
40 case '1':
|
|
41 sendMessage('image');
|
|
42 break;
|
|
43 case '2':
|
|
44 break;
|
|
45 case '3':
|
|
46 ok( 'imageLoad' === messageData.type, 'type = imageLoad');
|
|
47 start();
|
|
48 }
|
|
49 }
|
|
50 });
|
|
51 });
|
|
52 }
|
|
53
|
|
54 if (MutationObserver)
|
|
55 mutationObserverTest()
|
|
56 else{
|
|
57 console.warn('(MutationObserver not supported in this browser! Unable to run test)');
|
|
58 test('iFrame MutationObserver',function(){
|
|
59 ok(true,'MutationObserver not supported in this browser! Unable to run test.');
|
|
60 });
|
|
61 }
|
|
62
|
|
63 </script>
|
|
64 </body>
|
|
65 </html> |