diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-03 15:21:16 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:21:06 -0400 |
commit | 7c896ddb8563e1f4fc655904614cf72d010e2ecb (patch) | |
tree | 160c3d2c1c4aa7e89f38f8371558f3fccd8e8d8a /tests/lib/helper.js | |
parent | d0ea32e3ad613eaaa523d0c88c776dab2b26b25f (diff) | |
download | jquery-ui-7c896ddb8563e1f4fc655904614cf72d010e2ecb.tar.gz jquery-ui-7c896ddb8563e1f4fc655904614cf72d010e2ecb.zip |
Tests: Change test infrastructure to use AMD and reduce boilerplate
Ref #10119
Ref gh-1528
* Adds RequireJS and relies on AMD for loading dependencies.
* Updates to grunt-contrib-qunit 0.6.0.
* Convert `domEqual()` to a proper QUnit assertion.
* Introduces two bootstrap files (JS and CSS) which use `data-` attributes to
reduce the amount of boilerplate needed in each test
Diffstat (limited to 'tests/lib/helper.js')
-rw-r--r-- | tests/lib/helper.js | 33 |
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; + +}); |