first commit
This commit is contained in:
73
iframe-resizer-master_old/test/_init_once_async.html
Executable file
73
iframe-resizer-master_old/test/_init_once_async.html
Executable file
@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>QUnit LoadHide</title>
|
||||
<link rel="stylesheet" href="resources/qunit.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
<div class="iframe-wrapper" style="width:600px;">
|
||||
<iframe
|
||||
src="resources/frame.content.html"
|
||||
width="100%"
|
||||
scrolling="no"
|
||||
></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/qunit.js"></script>
|
||||
<script src="resources/jquery.js"></script>
|
||||
<script src="../js/ie8.polyfils.min.js"></script>
|
||||
<script src="../src/iframeResizer.js"></script>
|
||||
<script>
|
||||
'use strict'
|
||||
var $iframeFirst = $('iframe')
|
||||
var recievedIframeIds = []
|
||||
function getIframeFirstAttrs() {
|
||||
var attrs = {}
|
||||
var blacklistedAttrs = { id: true }
|
||||
function cloneAllowedAttr() {
|
||||
var attrName = this.name
|
||||
if (!(attrName in blacklistedAttrs)) {
|
||||
attrs[attrName] = this.value
|
||||
}
|
||||
}
|
||||
$.each($iframeFirst[0].attributes, cloneAllowedAttr)
|
||||
return attrs
|
||||
}
|
||||
|
||||
function addSecondIframeAndScript() {
|
||||
var $injectedIframe = $('<iframe/>').attr(getIframeFirstAttrs())
|
||||
var firstScriptSource = $('script[src*=iframeResizer]').attr('src')
|
||||
$iframeFirst.after($injectedIframe)
|
||||
$.getScript(firstScriptSource, function() {
|
||||
iFrameResize({
|
||||
//log:true,
|
||||
bodyBackground: 'wheat',
|
||||
heightCalculationMethod: 'max',
|
||||
onInit: function(iframe) {
|
||||
ok(true, 'Receive init message back from iFrame1.')
|
||||
ok('iFrameResizer1' === iframe.id, 'iFrame id = iFrameResizer1.')
|
||||
start()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
asyncTest('postMessage Response', function() {
|
||||
iFrameResize({
|
||||
//log:true,
|
||||
bodyBackground: 'wheat',
|
||||
heightCalculationMethod: 'max',
|
||||
onInit: function(iframe) {
|
||||
ok(true, 'Receive init message back from iFrame0.')
|
||||
ok('iFrameResizer0' === iframe.id, 'iFrame id = iFrameResizer0.')
|
||||
addSecondIframeAndScript()
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user