aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/helper.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/helper.js')
-rw-r--r--tests/lib/helper.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/helper.js b/tests/lib/helper.js
new file mode 100644
index 000000000..80cb27274
--- /dev/null
+++ b/tests/lib/helper.js
@@ -0,0 +1,33 @@
+define([
+ "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>" )
+ .css({
+ height: "11000px",
+ width: "11000px"
+ })
+ .appendTo( appendTo || "#qunit-fixture" );
+};
+
+exports.onFocus = function( element, onFocus ) {
+ var fn = function( event ) {
+ if ( !event.originalEvent ) {
+ return;
+ }
+ element.unbind( "focus", fn );
+ onFocus();
+ };
+
+ element.bind( "focus", fn )[ 0 ].focus();
+};
+
+return exports;
+
+});