diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2009-08-30 10:46:20 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2009-08-30 10:46:20 +0000 |
commit | 7f54a1bad9d9bb74e74904d584bfd9b0a4278663 (patch) | |
tree | 2eb706153cfff17371ddbdf2ffeba93056e83f91 | |
parent | da0aeced9de1184d799d467b8c096724969e4623 (diff) | |
download | jquery-ui-7f54a1bad9d9bb74e74904d584bfd9b0a4278663.tar.gz jquery-ui-7f54a1bad9d9bb74e74904d584bfd9b0a4278663.zip |
update to lastest QUnit
-rw-r--r-- | external/testrunner-r6416.js (renamed from external/testrunner-r6343.js) | 71 | ||||
-rw-r--r-- | tests/unit/accordion/accordion.html | 2 | ||||
-rw-r--r-- | tests/unit/all/all.html | 2 | ||||
-rw-r--r-- | tests/unit/all/all_2.html | 2 | ||||
-rw-r--r-- | tests/unit/core/core.html | 2 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker.html | 2 | ||||
-rw-r--r-- | tests/unit/defaults.html | 2 | ||||
-rw-r--r-- | tests/unit/dialog/dialog.html | 2 | ||||
-rw-r--r-- | tests/unit/draggable/draggable.html | 2 | ||||
-rw-r--r-- | tests/unit/droppable/droppable.html | 2 | ||||
-rw-r--r-- | tests/unit/position/position.html | 2 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar.html | 2 | ||||
-rw-r--r-- | tests/unit/resizable/resizable.html | 2 | ||||
-rw-r--r-- | tests/unit/selectable/selectable.html | 2 | ||||
-rw-r--r-- | tests/unit/slider/slider.html | 2 | ||||
-rw-r--r-- | tests/unit/sortable/sortable.html | 2 | ||||
-rw-r--r-- | tests/unit/tabs/tabs.html | 2 |
17 files changed, 58 insertions, 45 deletions
diff --git a/external/testrunner-r6343.js b/external/testrunner-r6416.js index 677bdd098..8c28b6398 100644 --- a/external/testrunner-r6343.js +++ b/external/testrunner-r6416.js @@ -7,12 +7,12 @@ * Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
- * $Id: testrunner.js 6343 2009-05-06 15:09:22Z joern.zaefferer $
+ * $Id: testrunner.js 6416 2009-07-10 16:08:27Z joern.zaefferer $
*/
(function($) {
-// Tests for equality any JavaScript type and structure without unexpected results.
+// Test for equality any JavaScript type.
// Discussions and reference: http://philrathe.com/articles/equiv
// Test suites: http://philrathe.com/tests/equiv
// Author: Philippe Rathé <prathe@gmail.com>
@@ -21,15 +21,16 @@ var equiv = function () { var innerEquiv; // the real equiv function
var callers = []; // stack to decide between skip/abort functions
+
// Determine what is o.
function hoozit(o) {
- if (typeof o === "string") {
+ if (o.constructor === String) {
return "string";
-
- } else if (typeof o === "boolean") {
+
+ } else if (o.constructor === Boolean) {
return "boolean";
- } else if (typeof o === "number") {
+ } else if (o.constructor === Number) {
if (isNaN(o)) {
return "nan";
@@ -64,6 +65,8 @@ var equiv = function () { } else if (o instanceof Function) {
return "function";
+ } else {
+ return undefined;
}
}
@@ -78,12 +81,19 @@ var equiv = function () { }
}
}
-
+
var callbacks = function () {
// for string, boolean, number and null
function useStrictEquality(b, a) {
- return a === b;
+ if (b instanceof a.constructor || a instanceof b.constructor) {
+ // to catch short annotaion VS 'new' annotation of a declaration
+ // e.g. var i = 1;
+ // var j = new Number(1);
+ return a == b;
+ } else {
+ return a === b;
+ }
}
return {
@@ -182,10 +192,8 @@ var equiv = function () { return (function (a, b) {
if (a === b) {
return true; // catch the most you can
-
- } else if (typeof a !== typeof b || a === null || b === null || typeof a === "undefined" || typeof b === "undefined") {
+ } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {
return false; // don't lose time with error prone cases
-
} else {
return bindCallbacks(a, callbacks, [b, a]);
}
@@ -195,7 +203,8 @@ var equiv = function () { };
return innerEquiv;
-}(); // equiv
+
+}();
var GETParams = $.map( location.search.slice(1).split('&'), decodeURIComponent ),
ngindex = $.inArray("noglobals", GETParams),
@@ -337,7 +346,7 @@ function runTest() { synchronize(function() {
$('<p id="testresult" class="result"/>').html(['Tests completed in ',
+new Date - started, ' milliseconds.<br/>',
- '<span class="bad">', config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> failed.']
+ '<span class="bad">', config.stats.all - config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> passed, ', config.stats.bad,' failed.']
.join(''))
.appendTo("body");
$("#banner").addClass(config.stats.bad ? "fail" : "pass");
@@ -380,6 +389,8 @@ function test(name, callback) { if ( !validTest(name) )
return;
+
+ var testEnvironment = {};
synchronize(function() {
config.assertions = [];
@@ -387,20 +398,16 @@ function test(name, callback) { try {
if( !pollution )
saveGlobal();
- lifecycle.setup();
+ lifecycle.setup.call(testEnvironment);
} catch(e) {
QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
}
- })
+ });
synchronize(function() {
try {
- callback();
+ callback.call(testEnvironment);
} catch(e) {
- if( typeof console != "undefined" && console.error && console.warn ) {
- console.error("Test " + name + " died, exception and test follows");
- console.error(e);
- console.warn(callback.toString());
- }
+ fail("Test " + name + " died, exception and test follows", e, callback);
QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
// else next test will carry the responsibility
saveGlobal();
@@ -409,20 +416,16 @@ function test(name, callback) { synchronize(function() {
try {
checkPollution();
- lifecycle.teardown();
+ lifecycle.teardown.call(testEnvironment);
} catch(e) {
QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
}
- })
+ });
synchronize(function() {
try {
reset();
} catch(e) {
- if( typeof console != "undefined" && console.error && console.warn ) {
- console.error("reset() failed, following Test " + name + ", exception and reset fn follows");
- console.error(e);
- console.warn(reset.toString());
- }
+ fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);
}
if(config.expected && config.expected != config.assertions.length) {
@@ -460,6 +463,16 @@ function test(name, callback) { });
}
+function fail(message, exception, callback) {
+ if( typeof console != "undefined" && console.error && console.warn ) {
+ console.error(message);
+ console.error(exception);
+ console.warn(callback.toString());
+ } else if (window.opera && opera.postError) {
+ opera.postError(message, exception, callback.toString);
+ }
+}
+
// call on start of module test to prepend name to all tests
function module(name, lifecycle) {
config.currentModule = name;
@@ -645,7 +658,7 @@ function triggerEvent( elem, type, event ) { };
function join( pre, arr, post ){
var s = jsDump.separator(),
- base = jsDump.indent();
+ base = jsDump.indent(),
inner = jsDump.indent(1);
if( arr.join )
arr = arr.join( ',' + s + inner );
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index cb4b67f32..9e1e9a3c8 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="accordion_core.js"></script> diff --git a/tests/unit/all/all.html b/tests/unit/all/all.html index e5e739eb0..c8e444048 100644 --- a/tests/unit/all/all.html +++ b/tests/unit/all/all.html @@ -18,7 +18,7 @@ <script type="text/javascript" src="../../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../../ui/ui.tabs.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../../external/jquery.cookie-r6165.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> diff --git a/tests/unit/all/all_2.html b/tests/unit/all/all_2.html index 4cefb599e..88bdb6dbc 100644 --- a/tests/unit/all/all_2.html +++ b/tests/unit/all/all_2.html @@ -51,7 +51,7 @@ <script type="text/javascript" src="../../../ui/ui.sortable.js"></script> <script type="text/javascript" src="../../../ui/ui.tabs.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../../external/jquery.cookie-r6165.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 308f22b84..49caa2ab7 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -8,7 +8,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="core.js"></script> diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index 917f43d5f..5b62f72b9 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -13,7 +13,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="datepicker_core.js"></script> diff --git a/tests/unit/defaults.html b/tests/unit/defaults.html index 9f7565541..19e7b6ee8 100644 --- a/tests/unit/defaults.html +++ b/tests/unit/defaults.html @@ -19,7 +19,7 @@ <link type="text/css" href="testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="testsuite.js"></script> - <script type="text/javascript" src="../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../external/jquery.cookie-r6165.js"></script> <script type="text/javascript" src="../jquery.simulate.js"></script> diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 635ac8bf7..4679c3131 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -13,7 +13,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="dialog_core.js"></script> diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index a5ae27ff8..921baae31 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="draggable_core.js"></script> diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index 972c8b8ff..0a5d35f94 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -10,7 +10,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="droppable_core.js"></script> diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index 6d9a00008..1381ce558 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="../testsuite.js"></script>
- <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script>
+ <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script>
<script type="text/javascript" src="position_core.js"></script>
</head>
diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index 9306e836d..b678f3df6 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="progressbar_core.js"></script> diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index f5aba9a66..c9260f2f5 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="resizable_core.js"></script> diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html index f398eb237..1b401f13a 100644 --- a/tests/unit/selectable/selectable.html +++ b/tests/unit/selectable/selectable.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="selectable_core.js"></script> diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html index c811cac0c..c4d97de82 100644 --- a/tests/unit/slider/slider.html +++ b/tests/unit/slider/slider.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="slider_core.js"></script> diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index 487771f32..e3a87a9b0 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> <script type="text/javascript" src="sortable_core.js"></script> diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index 9adc938c7..644f21bc8 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -9,7 +9,7 @@ <link type="text/css" href="../testsuite.css" rel="stylesheet" /> <script type="text/javascript" src="../testsuite.js"></script> - <script type="text/javascript" src="../../../external/testrunner-r6343.js"></script> + <script type="text/javascript" src="../../../external/testrunner-r6416.js"></script> <script type="text/javascript" src="../../../external/jquery.cookie-r6165.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> |