diff options
Diffstat (limited to 'js/tests/index.html')
-rw-r--r-- | js/tests/index.html | 87 |
1 files changed, 81 insertions, 6 deletions
diff --git a/js/tests/index.html b/js/tests/index.html index c1b5b39141..d1ec0a7f40 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -7,19 +7,55 @@ <!-- jQuery --> <script src="vendor/jquery.min.js"></script> + <script> + // Disable jQuery event aliases to ensure we don't accidentally use any of them + (function () { + var eventAliases = [ + 'blur', + 'focus', + 'focusin', + 'focusout', + 'load', + 'resize', + 'scroll', + 'unload', + 'click', + 'dblclick', + 'mousedown', + 'mouseup', + 'mousemove', + 'mouseover', + 'mouseout', + 'mouseenter', + 'mouseleave', + 'change', + 'select', + 'submit', + 'keydown', + 'keypress', + 'keyup', + 'error', + 'contextmenu', + 'hover', + 'bind', + 'unbind', + 'delegate', + 'undelegate' + ] + for (var i = 0; i < eventAliases.length; i++) { + $.fn[eventAliases[i]] = undefined + } + })() + </script> <!-- QUnit --> <link rel="stylesheet" href="vendor/qunit.css" media="screen"> <script src="vendor/qunit.js"></script> - <style> - #qunit-fixture { - top: 0; - left: 0; - } - </style> <script> // See https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit var log = [] + // Require assert.expect in each test. + QUnit.config.requireExpects = true QUnit.done(function (testResults) { var tests = [] for (var i = 0, len = log.length; i < len; i++) { @@ -52,6 +88,45 @@ $('#qunit-fixture').empty() $('#modal-test, .modal-backdrop').remove() }) + + // Display fixture on-screen on iOS to avoid false positives + if (/iPhone|iPad|iPod/.test(navigator.userAgent)) { + QUnit.begin(function() { + $('#qunit-fixture').css({ top: 0, left: 0 }) + }) + + QUnit.done(function () { + $('#qunit-fixture').css({ top: '', left: '' }) + }) + } + + // Disable deprecated global QUnit method aliases in preparation for QUnit v2 + (function () { + var methodNames = [ + 'async', + 'asyncTest', + 'deepEqual', + 'equal', + 'expect', + 'module', + 'notDeepEqual', + 'notEqual', + 'notPropEqual', + 'notStrictEqual', + 'ok', + 'propEqual', + 'push', + 'start', + 'stop', + 'strictEqual', + 'test', + 'throws' + ]; + for (var i = 0; i < methodNames.length; i++) { + var methodName = methodNames[i]; + window[methodName] = undefined; + } + })(); </script> <!-- Plugin sources --> |