Tests: Allow a mock QUnit.test for perfect testIframe fidelity

Ref 1d2df772b4
Closes gh-3647
This commit is contained in:
Richard Gibson 2017-04-25 16:22:35 -04:00 committed by GitHub
parent bb79f728b0
commit bb757213b2
2 changed files with 16 additions and 14 deletions

View File

@ -231,8 +231,11 @@ this.ajaxTest = function( title, expect, options ) {
} );
};
this.testIframe = function( title, fileName, func ) {
QUnit.test( title, function( assert ) {
this.testIframe = function( title, fileName, func, wrapper ) {
if ( !wrapper ) {
wrapper = QUnit.test;
}
wrapper.call( QUnit, title, function( assert ) {
var done = assert.async(),
$iframe = supportjQuery( "<iframe/>" )
.css( { position: "absolute", width: "500px", left: "-600px" } )

View File

@ -26,18 +26,17 @@ var supportsFixedPosition, supportsScroll, alwaysScrollable,
// Support: iOS <=7
// Hijack the iframe test infrastructure to detect viewport scrollability
// for pages with position:fixed document element
var done = assert.async(),
$iframe = supportjQuery( "<iframe/>" )
.css( { position: "absolute", width: "50px", left: "-60px" } )
.attr( "src", url( "./data/offset/boxes.html" ) );
window.iframeCallback = function( $, win, doc ) {
doc.documentElement.style.position = "fixed";
alwaysScrollable = win.pageXOffset !== 0;
window.iframeCallback = undefined;
$iframe.remove();
done();
};
$iframe.appendTo( document.body );
var done = assert.async();
testIframe(
null,
"offset/boxes.html",
function( assert, $, win, doc ) {
doc.documentElement.style.position = "fixed";
alwaysScrollable = win.pageXOffset !== 0;
done();
},
function( _, mockTest ) { mockTest( assert ); }
);
};
QUnit.module( "offset", { setup: function( assert ) {