mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: Allow a mock QUnit.test for perfect testIframe fidelity
Ref 1d2df772b4
Closes gh-3647
This commit is contained in:
parent
bb79f728b0
commit
bb757213b2
@ -231,8 +231,11 @@ this.ajaxTest = function( title, expect, options ) {
|
|||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
this.testIframe = function( title, fileName, func ) {
|
this.testIframe = function( title, fileName, func, wrapper ) {
|
||||||
QUnit.test( title, function( assert ) {
|
if ( !wrapper ) {
|
||||||
|
wrapper = QUnit.test;
|
||||||
|
}
|
||||||
|
wrapper.call( QUnit, title, function( assert ) {
|
||||||
var done = assert.async(),
|
var done = assert.async(),
|
||||||
$iframe = supportjQuery( "<iframe/>" )
|
$iframe = supportjQuery( "<iframe/>" )
|
||||||
.css( { position: "absolute", width: "500px", left: "-600px" } )
|
.css( { position: "absolute", width: "500px", left: "-600px" } )
|
||||||
|
@ -26,18 +26,17 @@ var supportsFixedPosition, supportsScroll, alwaysScrollable,
|
|||||||
// Support: iOS <=7
|
// Support: iOS <=7
|
||||||
// Hijack the iframe test infrastructure to detect viewport scrollability
|
// Hijack the iframe test infrastructure to detect viewport scrollability
|
||||||
// for pages with position:fixed document element
|
// for pages with position:fixed document element
|
||||||
var done = assert.async(),
|
var done = assert.async();
|
||||||
$iframe = supportjQuery( "<iframe/>" )
|
testIframe(
|
||||||
.css( { position: "absolute", width: "50px", left: "-60px" } )
|
null,
|
||||||
.attr( "src", url( "./data/offset/boxes.html" ) );
|
"offset/boxes.html",
|
||||||
window.iframeCallback = function( $, win, doc ) {
|
function( assert, $, win, doc ) {
|
||||||
doc.documentElement.style.position = "fixed";
|
doc.documentElement.style.position = "fixed";
|
||||||
alwaysScrollable = win.pageXOffset !== 0;
|
alwaysScrollable = win.pageXOffset !== 0;
|
||||||
window.iframeCallback = undefined;
|
|
||||||
$iframe.remove();
|
|
||||||
done();
|
done();
|
||||||
};
|
},
|
||||||
$iframe.appendTo( document.body );
|
function( _, mockTest ) { mockTest( assert ); }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
QUnit.module( "offset", { setup: function( assert ) {
|
QUnit.module( "offset", { setup: function( assert ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user