2015-08-21 04:13:44 +00:00
|
|
|
define( [
|
2015-04-03 19:21:16 +00:00
|
|
|
"jquery"
|
|
|
|
], function( $ ) {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
|
|
|
exports.forceScrollableWindow = function( appendTo ) {
|
|
|
|
|
|
|
|
// The main testable area is 10000x10000 so to enforce scrolling,
|
|
|
|
// this DIV must be greater than 10000 to work
|
|
|
|
return $( "<div>" )
|
2015-08-21 04:13:44 +00:00
|
|
|
.css( {
|
2015-04-03 19:21:16 +00:00
|
|
|
height: "11000px",
|
|
|
|
width: "11000px"
|
2015-08-21 04:13:44 +00:00
|
|
|
} )
|
2015-04-03 19:21:16 +00:00
|
|
|
.appendTo( appendTo || "#qunit-fixture" );
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.onFocus = function( element, onFocus ) {
|
|
|
|
var fn = function( event ) {
|
|
|
|
if ( !event.originalEvent ) {
|
|
|
|
return;
|
|
|
|
}
|
2015-05-14 02:05:32 +00:00
|
|
|
element.off( "focus", fn );
|
2015-04-03 19:21:16 +00:00
|
|
|
onFocus();
|
|
|
|
};
|
|
|
|
|
2015-05-14 02:05:32 +00:00
|
|
|
element.on( "focus", fn )[ 0 ].focus();
|
2015-04-03 19:21:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
|
2015-08-21 04:13:44 +00:00
|
|
|
} );
|