From 72023dd045a7fead5a3136ec2400ad4743a190d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=CC=88rn=20Zaefferer?= Date: Tue, 28 Feb 2012 15:56:32 +0100 Subject: [PATCH] Update to QUnit 1.3. Replace usage of same with deepEqual and equals with equal. --- external/qunit.css | 11 +- external/qunit.js | 760 +++++++++++------- tests/unit/accordion/accordion_events.js | 12 +- tests/unit/button/button_core.js | 24 +- tests/unit/button/button_options.js | 38 +- tests/unit/core/core.js | 70 +- tests/unit/datepicker/datepicker_core.js | 70 +- tests/unit/datepicker/datepicker_events.js | 50 +- tests/unit/datepicker/datepicker_options.js | 304 +++---- tests/unit/datepicker/datepicker_tickets.js | 16 +- tests/unit/dialog/dialog_core.js | 18 +- tests/unit/dialog/dialog_events.js | 84 +- tests/unit/dialog/dialog_methods.js | 30 +- tests/unit/dialog/dialog_options.js | 154 ++-- tests/unit/dialog/dialog_tickets.js | 16 +- tests/unit/draggable/draggable_core.js | 2 +- tests/unit/draggable/draggable_events.js | 18 +- tests/unit/draggable/draggable_methods.js | 18 +- tests/unit/draggable/draggable_options.js | 148 ++-- tests/unit/droppable/droppable_methods.js | 20 +- tests/unit/droppable/droppable_options.js | 4 +- tests/unit/menu/menu_core.js | 12 +- tests/unit/menu/menu_events.js | 116 +-- tests/unit/menu/menu_methods.js | 8 +- tests/unit/menu/menu_options.js | 4 +- tests/unit/position/position_core.js | 70 +- tests/unit/position/position_core_within.js | 56 +- tests/unit/position/position_deprecated.js | 6 +- tests/unit/progressbar/progressbar_core.js | 14 +- tests/unit/progressbar/progressbar_events.js | 10 +- tests/unit/progressbar/progressbar_methods.js | 10 +- tests/unit/progressbar/progressbar_options.js | 10 +- tests/unit/resizable/resizable_core.js | 50 +- tests/unit/resizable/resizable_methods.js | 6 +- tests/unit/resizable/resizable_options.js | 104 +-- tests/unit/selectable/selectable_events.js | 4 +- tests/unit/selectable/selectable_methods.js | 18 +- tests/unit/selectable/selectable_options.js | 8 +- tests/unit/slider/slider_core.js | 68 +- tests/unit/slider/slider_events.js | 22 +- tests/unit/slider/slider_methods.js | 28 +- tests/unit/slider/slider_options.js | 26 +- tests/unit/sortable/sortable_methods.js | 18 +- tests/unit/sortable/sortable_tickets.js | 4 +- tests/unit/spinner/spinner_methods.js | 58 +- tests/unit/spinner/spinner_options.js | 36 +- tests/unit/tabs/tabs.html | 6 +- tests/unit/tabs/tabs_core.js | 8 +- tests/unit/tabs/tabs_deprecated.html | 6 +- tests/unit/tabs/tabs_deprecated.js | 126 +-- tests/unit/tabs/tabs_events.js | 118 +-- tests/unit/tabs/tabs_methods.js | 28 +- tests/unit/tabs/tabs_options.js | 22 +- tests/unit/testsuite.js | 8 +- tests/unit/tooltip/tooltip_events.js | 12 +- tests/unit/tooltip/tooltip_methods.js | 4 +- tests/unit/tooltip/tooltip_options.js | 14 +- tests/unit/widget/widget_core.js | 204 ++--- 58 files changed, 1688 insertions(+), 1501 deletions(-) diff --git a/external/qunit.css b/external/qunit.css index b3c6db523..3334e21de 100644 --- a/external/qunit.css +++ b/external/qunit.css @@ -1,9 +1,9 @@ /** - * QUnit - A JavaScript Unit Testing Framework + * QUnit v1.3.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * - * Copyright (c) 2011 John Resig, Jörn Zaefferer + * Copyright (c) 2012 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ @@ -54,6 +54,10 @@ color: #fff; } +#qunit-header label { + display: inline-block; +} + #qunit-banner { height: 5px; } @@ -186,6 +190,7 @@ color: #710909; background-color: #fff; border-left: 26px solid #EE5757; + white-space: pre; } #qunit-tests > li:last-child { @@ -222,4 +227,6 @@ position: absolute; top: -10000px; left: -10000px; + width: 1000px; + height: 1000px; } diff --git a/external/qunit.js b/external/qunit.js index a1b3fa5e9..cd5631d86 100644 --- a/external/qunit.js +++ b/external/qunit.js @@ -1,9 +1,9 @@ /** - * QUnit - A JavaScript Unit Testing Framework + * QUnit v1.3.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * - * Copyright (c) 2011 John Resig, Jörn Zaefferer + * Copyright (c) 2012 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ @@ -13,21 +13,25 @@ var defined = { setTimeout: typeof window.setTimeout !== "undefined", sessionStorage: (function() { + var x = "qunit-test-string"; try { - return !!sessionStorage.getItem; - } catch(e){ + sessionStorage.setItem(x, x); + sessionStorage.removeItem(x); + return true; + } catch(e) { return false; } - })() + })() }; -var testId = 0; +var testId = 0, + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty; -var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { +var Test = function(name, testName, expected, async, callback) { this.name = name; this.testName = testName; this.expected = expected; - this.testEnvironmentArg = testEnvironmentArg; this.async = async; this.callback = callback; this.assertions = []; @@ -48,7 +52,7 @@ Test.prototype = { setup: function() { if (this.module != config.previousModule) { if ( config.previousModule ) { - QUnit.moduleDone( { + runLoggingCallbacks('moduleDone', QUnit, { name: config.previousModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, @@ -57,7 +61,11 @@ Test.prototype = { } config.previousModule = this.module; config.moduleStats = { all: 0, bad: 0 }; - QUnit.moduleStart( { + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module + } ); + } else if (config.autorun) { + runLoggingCallbacks( 'moduleStart', QUnit, { name: this.module } ); } @@ -67,13 +75,11 @@ Test.prototype = { setup: function() {}, teardown: function() {} }, this.moduleTestEnvironment); - if (this.testEnvironmentArg) { - extend(this.testEnvironment, this.testEnvironmentArg); - } - QUnit.testStart( { - name: this.testName - } ); + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module + }); // allow utility functions to access the current test environment // TODO why?? @@ -90,6 +96,7 @@ Test.prototype = { } }, run: function() { + config.current = this; if ( this.async ) { QUnit.stop(); } @@ -108,11 +115,12 @@ Test.prototype = { // Restart the tests if they're blocking if ( config.blocking ) { - start(); + QUnit.start(); } } }, teardown: function() { + config.current = this; try { this.testEnvironment.teardown.call(this.testEnvironment); checkPollution(); @@ -121,7 +129,8 @@ Test.prototype = { } }, finish: function() { - if ( this.expected && this.expected != this.assertions.length ) { + config.current = this; + if ( this.expected != null && this.expected != this.assertions.length ) { QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); } @@ -132,7 +141,7 @@ Test.prototype = { config.moduleStats.all += this.assertions.length; if ( tests ) { - var ol = document.createElement("ol"); + var ol = document.createElement("ol"); for ( var i = 0; i < this.assertions.length; i++ ) { var assertion = this.assertions[i]; @@ -210,8 +219,9 @@ Test.prototype = { fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); } - QUnit.testDone( { + runLoggingCallbacks( 'testDone', QUnit, { name: this.testName, + module: this.module, failed: bad, passed: this.assertions.length - bad, total: this.assertions.length @@ -243,7 +253,7 @@ Test.prototype = { if (bad) { run(); } else { - synchronize(run); + synchronize(run, true); }; } @@ -260,24 +270,19 @@ var QUnit = { asyncTest: function(testName, expected, callback) { if ( arguments.length === 2 ) { callback = expected; - expected = 0; + expected = null; } QUnit.test(testName, expected, callback, true); }, test: function(testName, expected, callback, async) { - var name = '' + testName + '', testEnvironmentArg; + var name = '' + escapeInnerText(testName) + ''; if ( arguments.length === 2 ) { callback = expected; expected = null; } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } if ( config.currentModule ) { name = '' + config.currentModule + ": " + name; @@ -287,7 +292,7 @@ var QUnit = { return; } - var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); + var test = new Test(name, testName, expected, async, callback); test.module = config.currentModule; test.moduleTestEnvironment = config.currentModuleTestEnviroment; test.queue(); @@ -305,13 +310,16 @@ var QUnit = { * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ ok: function(a, msg) { + if (!config.current) { + throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2)); + } a = !!a; var details = { result: a, message: msg }; - msg = escapeHtml(msg); - QUnit.log(details); + msg = escapeInnerText(msg); + runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: a, message: msg @@ -387,8 +395,8 @@ var QUnit = { QUnit.ok(ok, message); }, - start: function() { - config.semaphore--; + start: function(count) { + config.semaphore -= count || 1; if (config.semaphore > 0) { // don't start until equal number of stop-calls return; @@ -400,36 +408,54 @@ var QUnit = { // A slight delay, to avoid any current callbacks if ( defined.setTimeout ) { window.setTimeout(function() { + if (config.semaphore > 0) { + return; + } if ( config.timeout ) { clearTimeout(config.timeout); } config.blocking = false; - process(); + process(true); }, 13); } else { config.blocking = false; - process(); + process(true); } }, - stop: function(timeout) { - config.semaphore++; + stop: function(count) { + config.semaphore += count || 1; config.blocking = true; - if ( timeout && defined.setTimeout ) { + if ( config.testTimeout && defined.setTimeout ) { clearTimeout(config.timeout); config.timeout = window.setTimeout(function() { QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; QUnit.start(); - }, timeout); + }, config.testTimeout); } } }; -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; +//We want access to the constructor's prototype +(function() { + function F(){}; + F.prototype = QUnit; + QUnit = new F(); + //Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +})(); + +// deprecated; still export them to window to provide clear error messages +// next step: remove entirely +QUnit.equals = function() { + throw new Error("QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"); +}; +QUnit.same = function() { + throw new Error("QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead"); +}; // Maintain internal state var config = { @@ -439,12 +465,27 @@ var config = { // block until document ready blocking: true, + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + // by default, run previously failed tests first // very useful in combination with "Hide passed tests" checked reorder: true, - noglobals: false, - notrycatch: false + // by default, modify document.title when suite is done + altertitle: true, + + urlConfig: ['noglobals', 'notrycatch'], + + //logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] }; // Load paramaters @@ -462,9 +503,6 @@ var config = { // allow just a key to turn on a flag, e.g., test.html?noglobals current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; urlParams[ current[ 0 ] ] = current[ 1 ]; - if ( current[ 0 ] in config ) { - config[ current[ 0 ] ] = current[ 1 ]; - } } } @@ -481,8 +519,7 @@ if ( typeof exports === "undefined" || typeof require === "undefined" ) { extend(window, QUnit); window.QUnit = QUnit; } else { - extend(exports, QUnit); - exports.QUnit = QUnit; + module.exports = QUnit; } // define these after exposing globals to keep them in these QUnit namespace only @@ -504,6 +541,16 @@ extend(QUnit, { semaphore: 0 }); + var qunit = id( "qunit" ); + if ( qunit ) { + qunit.innerHTML = + '

' + escapeInnerText( document.title ) + '

' + + '

' + + '
' + + '

' + + '
    '; + } + var tests = id( "qunit-tests" ), banner = id( "qunit-banner" ), result = id( "qunit-testresult" ); @@ -532,15 +579,15 @@ extend(QUnit, { /** * Resets the test setup. Useful for tests that modify the DOM. * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. + * If jQuery is available, uses jQuery's replaceWith(), otherwise use replaceChild */ reset: function() { - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - var main = id( 'qunit-fixture' ); - if ( main ) { - main.innerHTML = config.fixture; + var main = id( 'qunit-fixture' ); + if ( main ) { + if ( window.jQuery ) { + jQuery( main ).replaceWith( config.fixture.cloneNode(true) ); + } else { + main.parentNode.replaceChild(config.fixture.cloneNode(true), main); } } }, @@ -580,8 +627,7 @@ extend(QUnit, { return "null"; } - var type = Object.prototype.toString.call( obj ) - .match(/^\[object\s(.*)\]$/)[1] || ''; + var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; switch (type) { case 'Number': @@ -605,6 +651,9 @@ extend(QUnit, { }, push: function(result, actual, expected, message) { + if (!config.current) { + throw new Error("assertion outside test context, was " + sourceFromStacktrace()); + } var details = { result: result, message: message, @@ -612,25 +661,26 @@ extend(QUnit, { expected: expected }; - message = escapeHtml(message) || (result ? "okay" : "failed"); + message = escapeInnerText(message) || (result ? "okay" : "failed"); message = '' + message + ""; - expected = escapeHtml(QUnit.jsDump.parse(expected)); - actual = escapeHtml(QUnit.jsDump.parse(actual)); - var output = message + ''; - if (actual != expected) { - output += ''; - output += ''; - } + var output = message; if (!result) { + expected = escapeInnerText(QUnit.jsDump.parse(expected)); + actual = escapeInnerText(QUnit.jsDump.parse(actual)); + output += '
    Expected:
    ' + expected + '
    Result:
    ' + actual + '
    Diff:
    ' + QUnit.diff(expected, actual) +'
    '; + if (actual != expected) { + output += ''; + output += ''; + } var source = sourceFromStacktrace(); if (source) { details.source = source; - output += ''; + output += ''; } + output += "
    Expected:
    ' + expected + '
    Result:
    ' + actual + '
    Diff:
    ' + QUnit.diff(expected, actual) +'
    Source:
    ' + escapeHtml(source) + '
    Source:
    ' + escapeInnerText(source) + '
    "; } - output += ""; - QUnit.log(details); + runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: !!result, @@ -643,6 +693,9 @@ extend(QUnit, { var querystring = "?", key; for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } querystring += encodeURIComponent( key ) + "=" + encodeURIComponent( params[ key ] ) + "&"; } @@ -651,31 +704,36 @@ extend(QUnit, { extend: extend, id: id, - addEvent: addEvent, + addEvent: addEvent +}); +//QUnit.constructor is set to the empty F() above so that we can add to it's prototype later +//Doing this allows us to tell if the following methods have been overwritten on the actual +//QUnit object, which is a deprecated way of using the callbacks. +extend(QUnit.constructor.prototype, { // Logging callbacks; all receive a single argument with the listed properties // run test/logs.html for any related changes - begin: function() {}, + begin: registerLoggingCallback('begin'), // done: { failed, passed, total, runtime } - done: function() {}, + done: registerLoggingCallback('done'), // log: { result, actual, expected, message } - log: function() {}, + log: registerLoggingCallback('log'), // testStart: { name } - testStart: function() {}, + testStart: registerLoggingCallback('testStart'), // testDone: { name, failed, passed, total } - testDone: function() {}, + testDone: registerLoggingCallback('testDone'), // moduleStart: { name } - moduleStart: function() {}, + moduleStart: registerLoggingCallback('moduleStart'), // moduleDone: { name, failed, passed, total } - moduleDone: function() {} + moduleDone: registerLoggingCallback('moduleDone') }); if ( typeof document === "undefined" || document.readyState === "complete" ) { config.autorun = true; } -addEvent(window, "load", function() { - QUnit.begin({}); +QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); // Initialize the config, saving the execution queue var oldconfig = extend({}, config); @@ -684,15 +742,19 @@ addEvent(window, "load", function() { config.blocking = false; + var urlConfigHtml = '', len = config.urlConfig.length; + for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) { + config[val] = QUnit.urlParams[val]; + urlConfigHtml += ''; + } + var userAgent = id("qunit-userAgent"); if ( userAgent ) { userAgent.innerHTML = navigator.userAgent; } var banner = id("qunit-header"); if ( banner ) { - banner.innerHTML = ' ' + banner.innerHTML + ' ' + - '' + - ''; + banner.innerHTML = ' ' + banner.innerHTML + ' ' + urlConfigHtml; addEvent( banner, "change", function( event ) { var params = {}; params[ event.target.name ] = event.target.checked ? true : undefined; @@ -715,13 +777,13 @@ addEvent(window, "load", function() { } if ( defined.sessionStorage ) { if (filter.checked) { - sessionStorage.setItem("qunit-filter-passed-tests", "true"); + sessionStorage.setItem("qunit-filter-passed-tests", "true"); } else { sessionStorage.removeItem("qunit-filter-passed-tests"); } } }); - if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { filter.checked = true; var ol = document.getElementById("qunit-tests"); ol.className = ol.className + " hidepass"; @@ -736,20 +798,33 @@ addEvent(window, "load", function() { var main = id('qunit-fixture'); if ( main ) { - config.fixture = main.innerHTML; + config.fixture = main.cloneNode(true); } if (config.autostart) { QUnit.start(); } -}); +}; + +addEvent(window, "load", QUnit.load); + +// addEvent(window, "error") gives us a useless event object +window.onerror = function( message, file, line ) { + if ( QUnit.config.current ) { + ok( false, message + ", " + file + ":" + line ); + } else { + test( "global failure", function() { + ok( false, message + ", " + file + ":" + line ); + }); + } +}; function done() { config.autorun = true; // Log the last module results if ( config.currentModule ) { - QUnit.moduleDone( { + runLoggingCallbacks( 'moduleDone', QUnit, { name: config.currentModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, @@ -782,13 +857,25 @@ function done() { id( "qunit-testresult" ).innerHTML = html; } - if ( typeof document !== "undefined" && document.title ) { - // show ✖ for bad, ✔ for good suite result in title + if ( config.altertitle && typeof document !== "undefined" && document.title ) { + // show ✖ for good, ✔ for bad suite result in title // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = (config.stats.bad ? "\u2716" : "\u2714") + " " + document.title; + document.title = [ + (config.stats.bad ? "\u2716" : "\u2714"), + document.title.replace(/^[\u2714\u2716] /i, "") + ].join(" "); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + for (var key in sessionStorage) { + if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-") === 0 ) { + sessionStorage.removeItem(key); + } + } } - QUnit.done( { + runLoggingCallbacks( 'done', QUnit, { failed: config.stats.bad, passed: passed, total: config.stats.all, @@ -822,30 +909,37 @@ function validTest( name ) { // so far supports only Firefox, Chrome and Opera (buggy) // could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace() { +function sourceFromStacktrace(offset) { + offset = offset || 3; try { throw new Error(); } catch ( e ) { if (e.stacktrace) { // Opera - return e.stacktrace.split("\n")[6]; + return e.stacktrace.split("\n")[offset + 3]; } else if (e.stack) { // Firefox, Chrome - return e.stack.split("\n")[4]; + var stack = e.stack.split("\n"); + if (/^error$/i.test(stack[0])) { + stack.shift(); + } + return stack[offset]; + } else if (e.sourceURL) { + // Safari, PhantomJS + // TODO sourceURL points at the 'throw new Error' line above, useless + //return e.sourceURL + ":" + e.line; } } } -function escapeHtml(s) { +function escapeInnerText(s) { if (!s) { return ""; } s = s + ""; - return s.replace(/[\&"<>\\]/g, function(s) { + return s.replace(/[\&<>]/g, function(s) { switch(s) { case "&": return "&"; - case "\\": return "\\\\"; - case '"': return '\"'; case "<": return "<"; case ">": return ">"; default: return s; @@ -853,28 +947,32 @@ function escapeHtml(s) { }); } -function synchronize( callback ) { +function synchronize( callback, last ) { config.queue.push( callback ); if ( config.autorun && !config.blocking ) { - process(); + process(last); } } -function process() { - var start = (new Date()).getTime(); +function process( last ) { + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { config.queue.shift()(); } else { - window.setTimeout( process, 13 ); + window.setTimeout( function(){ + process( last ); + }, 13 ); break; } } - if (!config.blocking && !config.queue.length) { - done(); - } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } } function saveGlobal() { @@ -882,6 +980,9 @@ function saveGlobal() { if ( config.noglobals ) { for ( var key in window ) { + if ( !hasOwn.call( window, key ) ) { + continue; + } config.pollution.push( key ); } } @@ -921,6 +1022,7 @@ function fail(message, exception, callback) { if ( typeof console !== "undefined" && console.error && console.warn ) { console.error(message); console.error(exception); + console.error(exception.stack); console.warn(callback.toString()); } else if ( window.opera && opera.postError ) { @@ -932,7 +1034,9 @@ function extend(a, b) { for ( var prop in b ) { if ( b[prop] === undefined ) { delete a[prop]; - } else { + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== "constructor" || a !== window ) { a[prop] = b[prop]; } } @@ -955,176 +1059,216 @@ function id(name) { document.getElementById( name ); } +function registerLoggingCallback(key){ + return function(callback){ + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks(key, scope, args) { + //debugger; + var callbacks; + if ( QUnit.hasOwnProperty(key) ) { + QUnit[key].call(scope, args); + } else { + callbacks = config[key]; + for( var i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } +} + // Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv // Author: Philippe Rathé QUnit.equiv = function () { - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = QUnit.objectType(o); - if (prop) { - if (QUnit.objectType(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - 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 { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return QUnit.objectType(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (QUnit.objectType(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j= 0) { + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { type = "array"; } else { type = typeof obj; @@ -1239,11 +1398,13 @@ QUnit.jsDump = (function() { array: array, nodelist: array, arguments: array, - object:function( map ) { + object:function( map, stack ) { var ret = [ ]; QUnit.jsDump.up(); - for ( var key in map ) - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) ); + for ( var key in map ) { + var val = map[key]; + ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack)); + } QUnit.jsDump.down(); return join( '{', ret, '}' ); }, @@ -1312,6 +1473,21 @@ function getText( elems ) { return ret; }; +//from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) @@ -1327,14 +1503,14 @@ function getText( elems ) { * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" */ QUnit.diff = (function() { - function diff(o, n){ - var ns = new Object(); - var os = new Object(); + function diff(o, n) { + var ns = {}; + var os = {}; for (var i = 0; i < n.length; i++) { if (ns[n[i]] == null) ns[n[i]] = { - rows: new Array(), + rows: [], o: null }; ns[n[i]].rows.push(i); @@ -1343,13 +1519,16 @@ QUnit.diff = (function() { for (var i = 0; i < o.length; i++) { if (os[o[i]] == null) os[o[i]] = { - rows: new Array(), + rows: [], n: null }; os[o[i]].rows.push(i); } for (var i in ns) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { n[ns[i].rows[0]] = { text: n[ns[i].rows[0]], @@ -1396,7 +1575,7 @@ QUnit.diff = (function() { }; } - return function(o, n){ + return function(o, n) { o = o.replace(/\s+$/, ''); n = n.replace(/\s+$/, ''); var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); @@ -1449,4 +1628,5 @@ QUnit.diff = (function() { }; })(); -})(this); +// get at whatever the global object is, like window in browsers +})( (function() {return this}).call() ); diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index b5c3ea228..dbb3e37df 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -11,9 +11,9 @@ test( "create", function() { element.accordion({ create: function( event, ui ) { - equals( ui.header.size(), 1, "header size" ); + equal( ui.header.size(), 1, "header size" ); strictEqual( ui.header[ 0 ], headers[ 0 ], "header" ); - equals( ui.content.size(), 1, "content size" ); + equal( ui.content.size(), 1, "content size" ); strictEqual( ui.content[ 0 ], contents[ 0 ], "content" ); } }); @@ -22,9 +22,9 @@ test( "create", function() { element.accordion({ active: 2, create: function( event, ui ) { - equals( ui.header.size(), 1, "header size" ); + equal( ui.header.size(), 1, "header size" ); strictEqual( ui.header[ 0 ], headers[ 2 ], "header" ); - equals( ui.content.size(), 1, "content size" ); + equal( ui.content.size(), 1, "content size" ); strictEqual( ui.content[ 0 ], contents[ 2 ], "content" ); } }); @@ -34,8 +34,8 @@ test( "create", function() { active: false, collapsible: true, create: function( event, ui ) { - equals( ui.header.size(), 0, "header size" ); - equals( ui.content.size(), 0, "content size" ); + equal( ui.header.size(), 0, "header size" ); + equal( ui.content.size(), 0, "content size" ); } }); element.accordion( "destroy" ); diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index 692c40320..c110b4311 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -10,7 +10,7 @@ module("button: core"); test("checkbox", function() { var input = $("#check"); label = $("label[for=check]"); - ok( input.is(":visible") ); + ok( input.is(":visible") ); ok( label.is(":not(.ui-button)") ); input.button(); ok( input.is(".ui-helper-hidden-accessible") ); @@ -20,7 +20,7 @@ test("checkbox", function() { test("radios", function() { var inputs = $("#radio0 input"); labels = $("#radio0 label"); - ok( inputs.is(":visible") ); + ok( inputs.is(":visible") ); ok( labels.is(":not(.ui-button)") ); inputs.button(); ok( inputs.is(".ui-helper-hidden-accessible") ); @@ -36,15 +36,15 @@ function assert(noForm, form1, form2) { test("radio groups", function() { $(":radio").button(); assert(":eq(0)", ":eq(1)", ":eq(2)"); - + // click outside of forms $("#radio0 .ui-button:eq(1)").click(); assert(":eq(1)", ":eq(1)", ":eq(2)"); - + // click in first form $("#radio1 .ui-button:eq(0)").click(); assert(":eq(1)", ":eq(0)", ":eq(2)"); - + // click in second form $("#radio2 .ui-button:eq(0)").click(); assert(":eq(1)", ":eq(0)", ":eq(0)"); @@ -52,16 +52,16 @@ test("radio groups", function() { test("input type submit, don't create child elements", function() { var input = $("#submit") - same( input.children().length, 0 ); + deepEqual( input.children().length, 0 ); input.button(); - same( input.children().length, 0 ); + deepEqual( input.children().length, 0 ); }); test("buttonset", function() { var set = $("#radio1").buttonset(); ok( set.is(".ui-buttonset") ); - same( set.children(".ui-button").length, 3 ); - same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); @@ -71,11 +71,11 @@ test("buttonset (rtl)", function() { var parent = $("#radio1").parent(); // Set to rtl parent.attr("dir", "rtl"); - + var set = $("#radio1").buttonset(); ok( set.is(".ui-buttonset") ); - same( set.children(".ui-button").length, 3 ); - same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); ok( set.children("label:eq(2)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index a3ab5ae10..9ef4a19db 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -7,26 +7,26 @@ module("button: options"); test("disabled, explicit value", function() { $("#radio01").button({ disabled: false }); - same(false, $("#radio01").button("option", "disabled"), + deepEqual(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").prop("disabled"), "element is disabled"); - + deepEqual(false, $("#radio01").prop("disabled"), "element is disabled"); + $("#radio02").button({ disabled: true }); - same(true, $("#radio02").button("option", "disabled"), + deepEqual(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").prop("disabled"), "element is not disabled"); + deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("disabled, null", function() { $("#radio01").button({ disabled: null }); - same(false, $("#radio01").button("option", "disabled"), + deepEqual(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").prop("disabled"), "element is disabled"); - + deepEqual(false, $("#radio01").prop("disabled"), "element is disabled"); + $("#radio02").prop("disabled", true).button({ disabled: null }); - same(true, $("#radio02").button("option", "disabled"), + deepEqual(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").prop("disabled"), "element is not disabled"); + deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("text false without icon", function() { @@ -34,7 +34,7 @@ test("text false without icon", function() { text: false }); ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") ); - + $("#button").button("destroy"); }); @@ -46,14 +46,14 @@ test("text false with icon", function() { } }); ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") ); - + $("#button").button("destroy"); }); test("label, default", function() { $("#button").button(); - same( $("#button").text(), "Label" ); - + deepEqual( $("#button").text(), "Label" ); + $("#button").button("destroy"); }); @@ -61,20 +61,20 @@ test("label", function() { $("#button").button({ label: "xxx" }); - same( $("#button").text(), "xxx" ); - + deepEqual( $("#button").text(), "xxx" ); + $("#button").button("destroy"); }); test("label default with input type submit", function() { - same( $("#submit").button().val(), "Label" ); + deepEqual( $("#submit").button().val(), "Label" ); }); test("label with input type submit", function() { var label = $("#submit").button({ label: "xxx" }).val(); - same( label, "xxx" ); + deepEqual( label, "xxx" ); }); test("icons", function() { @@ -86,7 +86,7 @@ test("icons", function() { } }); ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") ); - + $("#button").button("destroy"); }); diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 03a7ab810..53415584f 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -7,7 +7,7 @@ module('core - jQuery extensions'); test('focus - original functionality', function() { expect(1); - + $('#inputTabindex0') .focus(function() { ok(true, 'event triggered'); @@ -31,127 +31,127 @@ asyncTest('focus', function() { test('zIndex', function() { var el = $('#zIndexAutoWithParent'), parent = el.parent(); - equals(el.zIndex(), 100, 'zIndex traverses up to find value'); - equals(parent.zIndex(200), parent, 'zIndex setter is chainable'); - equals(el.zIndex(), 200, 'zIndex setter changed zIndex'); - + equal(el.zIndex(), 100, 'zIndex traverses up to find value'); + equal(parent.zIndex(200), parent, 'zIndex setter is chainable'); + equal(el.zIndex(), 200, 'zIndex setter changed zIndex'); + el = $('#zIndexAutoWithParentViaCSS'); - equals(el.zIndex(), 0, 'zIndex traverses up to find CSS value, not found because not positioned'); - + equal(el.zIndex(), 0, 'zIndex traverses up to find CSS value, not found because not positioned'); + el = $('#zIndexAutoWithParentViaCSSPositioned'); - equals(el.zIndex(), 100, 'zIndex traverses up to find CSS value'); + equal(el.zIndex(), 100, 'zIndex traverses up to find CSS value'); el.parent().zIndex(200); - equals(el.zIndex(), 200, 'zIndex setter changed zIndex, overriding CSS'); - - equals($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy'); + equal(el.zIndex(), 200, 'zIndex setter changed zIndex, overriding CSS'); + + equal($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy'); }); test( "innerWidth - getter", function() { var el = $( "#dimensions" ); - equals( el.innerWidth(), 122, "getter passthru" ); + equal( el.innerWidth(), 122, "getter passthru" ); el.hide(); - equals( el.innerWidth(), 122, "getter passthru when hidden" ); + equal( el.innerWidth(), 122, "getter passthru when hidden" ); }); test( "innerWidth - setter", function() { var el = $( "#dimensions" ); el.innerWidth( 120 ); - equals( el.width(), 98, "width set properly" ); + equal( el.width(), 98, "width set properly" ); el.hide(); el.innerWidth( 100 ); - equals( el.width(), 78, "width set properly when hidden" ); + equal( el.width(), 78, "width set properly when hidden" ); }); test( "innerHeight - getter", function() { var el = $( "#dimensions" ); - equals( el.innerHeight(), 70, "getter passthru" ); + equal( el.innerHeight(), 70, "getter passthru" ); el.hide(); - equals( el.innerHeight(), 70, "getter passthru when hidden" ); + equal( el.innerHeight(), 70, "getter passthru when hidden" ); }); test( "innerHeight - setter", function() { var el = $( "#dimensions" ); el.innerHeight( 60 ); - equals( el.height(), 40, "height set properly" ); + equal( el.height(), 40, "height set properly" ); el.hide(); el.innerHeight( 50 ); - equals( el.height(), 30, "height set properly when hidden" ); + equal( el.height(), 30, "height set properly when hidden" ); }); test( "outerWidth - getter", function() { var el = $( "#dimensions" ); - equals( el.outerWidth(), 140, "getter passthru" ); + equal( el.outerWidth(), 140, "getter passthru" ); el.hide(); - equals( el.outerWidth(), 140, "getter passthru when hidden" ); + equal( el.outerWidth(), 140, "getter passthru when hidden" ); }); test( "outerWidth - setter", function() { var el = $( "#dimensions" ); el.outerWidth( 130 ); - equals( el.width(), 90, "width set properly" ); + equal( el.width(), 90, "width set properly" ); el.hide(); el.outerWidth( 120 ); - equals( el.width(), 80, "width set properly when hidden" ); + equal( el.width(), 80, "width set properly when hidden" ); }); test( "outerWidth(true) - getter", function() { var el = $( "#dimensions" ); - equals( el.outerWidth(true), 154, "getter passthru w/ margin" ); + equal( el.outerWidth(true), 154, "getter passthru w/ margin" ); el.hide(); - equals( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); + equal( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); }); test( "outerWidth(true) - setter", function() { var el = $( "#dimensions" ); el.outerWidth( 130, true ); - equals( el.width(), 76, "width set properly" ); + equal( el.width(), 76, "width set properly" ); el.hide(); el.outerWidth( 120, true ); - equals( el.width(), 66, "width set properly when hidden" ); + equal( el.width(), 66, "width set properly when hidden" ); }); test( "outerHeight - getter", function() { var el = $( "#dimensions" ); - equals( el.outerHeight(), 86, "getter passthru" ); + equal( el.outerHeight(), 86, "getter passthru" ); el.hide(); - equals( el.outerHeight(), 86, "getter passthru when hidden" ); + equal( el.outerHeight(), 86, "getter passthru when hidden" ); }); test( "outerHeight - setter", function() { var el = $( "#dimensions" ); el.outerHeight( 80 ); - equals( el.height(), 44, "height set properly" ); + equal( el.height(), 44, "height set properly" ); el.hide(); el.outerHeight( 70 ); - equals( el.height(), 34, "height set properly when hidden" ); + equal( el.height(), 34, "height set properly when hidden" ); }); test( "outerHeight(true) - getter", function() { var el = $( "#dimensions" ); - equals( el.outerHeight(true), 98, "getter passthru w/ margin" ); + equal( el.outerHeight(true), 98, "getter passthru w/ margin" ); el.hide(); - equals( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); + equal( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); }); test( "outerHeight(true) - setter", function() { var el = $( "#dimensions" ); el.outerHeight( 90, true ); - equals( el.height(), 42, "height set properly" ); + equal( el.height(), 42, "height set properly" ); el.hide(); el.outerHeight( 80, true ); - equals( el.height(), 32, "height set properly when hidden" ); + equal( el.height(), 32, "height set properly when hidden" ); }); })(jQuery); diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index badb837ed..b674c708a 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -9,7 +9,7 @@ function equalsDate(d1, d2, message) { } d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate()); - equals(d1.toString(), d2.toString(), message); + equal(d1.toString(), d2.toString(), message); } function equalsDateArray(a1, a2, message) { @@ -21,7 +21,7 @@ function equalsDateArray(a1, a2, message) { a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : ''); a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : ''); a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : ''); - same(a1, a2, message); + deepEqual(a1, a2, message); } function addMonths(date, offset) { @@ -49,7 +49,7 @@ test( "widget method - empty collection", function() { test("widget method", function() { var actual = $("#inp").datepicker().datepicker("widget")[0]; - same($("body > #ui-datepicker-div:last-child")[0], actual); + deepEqual($("body > #ui-datepicker-div:last-child")[0], actual); }); test('baseStructure', function() { @@ -60,36 +60,36 @@ test('baseStructure', function() { ok(dp.is(':visible'), 'Structure - datepicker visible'); ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left'); ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month'); - equals(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count'); - + equal(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count'); + var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure - header division'); - equals(header.children().length, 3, 'Structure - header child count'); + equal(header.children().length, 3, 'Structure - header child count'); ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() != '', 'Structure - prev link'); ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() != '', 'Structure - next link'); - + var title = header.children(':last'); ok(title.is('div.ui-datepicker-title') && title.html() != '','Structure - title division'); - equals(title.children().length, 2, 'Structure - title child count'); + equal(title.children().length, 2, 'Structure - title child count'); ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() != '', 'Structure - month text') ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() != '', 'Structure - year text') - + var table = dp.children(':eq(1)'); ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table'); ok(table.children(':first').is('thead'), 'Structure - month table thead'); var thead = table.children(':first').children(':first'); ok(thead.is('tr'), 'Structure - month table title row'); - equals(thead.find('th').length, 7, 'Structure - month table title cells'); + equal(thead.find('th').length, 7, 'Structure - month table title cells'); ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body'); ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count'); var week = table.children(':eq(1)').children(':first'); ok(week.is('tr'), 'Structure - month table week row'); - equals(week.children().length, 7, 'Structure - week child count'); + equal(week.children().length, 7, 'Structure - week child count'); ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell'); ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell'); ok(dp.children('iframe').length == (iframe ? 1 : 0), 'Structure - iframe'); inp.datepicker('hide').datepicker('destroy'); - + // Editable month/year and button panel inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true}); inp.focus(); @@ -97,19 +97,19 @@ test('baseStructure', function() { var title = dp.find('div.ui-datepicker-title'); ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector'); ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector'); - + var panel = dp.children(':last'); ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division'); - equals(panel.children().length, 2, 'Structure - button panel child count'); + equal(panel.children().length, 2, 'Structure - button panel child count'); ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button'); ok(panel.children(':last').is('button.ui-datepicker-close'), 'Structure - close button'); inp.datepicker('hide').datepicker('destroy'); - + // Multi-month 2 inp = init('#inp', {numberOfMonths: 2}); inp.focus(); ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month'); - equals(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count'); + equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count'); var child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division'); child = dp.children(':eq(1)'); @@ -118,7 +118,7 @@ test('baseStructure', function() { ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break'); ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2'); inp.datepicker('hide').datepicker('destroy'); - + // Multi-month 3 inp = init('#inp', {numberOfMonths: 3}); inp.focus(); @@ -130,7 +130,7 @@ test('baseStructure', function() { inp = init('#inp', {numberOfMonths: [2, 2]}); inp.focus(); ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month'); - equals(dp.children().length, 6 + (iframe ? 1 : 0), 'Structure multi [2,2] - child count'); + equal(dp.children().length, 6 + (iframe ? 1 : 0), 'Structure multi [2,2] - child count'); child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - first month division'); child = dp.children(':eq(1)'); @@ -144,28 +144,28 @@ test('baseStructure', function() { child = dp.children(':eq(5)'); ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break'); inp.datepicker('hide').datepicker('destroy'); - + // Inline var inl = init('#inl'); dp = inl.children(); ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div'); ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left'); ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month'); - equals(dp.children().length, 2, 'Structure inline - child count'); + equal(dp.children().length, 2, 'Structure inline - child count'); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division'); - equals(header.children().length, 3, 'Structure inline - header child count'); + equal(header.children().length, 3, 'Structure inline - header child count'); var table = dp.children(':eq(1)'); ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table'); ok(table.children(':first').is('thead'), 'Structure inline - month table thead'); ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body'); inl.datepicker('destroy'); - + // Inline multi-month inl = init('#inl', {numberOfMonths: 2}); dp = inl.children(); - ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div'); - equals(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure inline multi - child count'); + ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div'); + equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure inline multi - child count'); child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure inline multi - first month division'); child = dp.children(':eq(1)'); @@ -185,12 +185,12 @@ test('customStructure', function() { ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left'); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division'); - equals(header.children().length, 3, 'Structure RTL - header child count'); + equal(header.children().length, 3, 'Structure RTL - header child count'); ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link'); - ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link'); + ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link'); var panel = dp.children(':last'); ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division'); - equals(panel.children().length, 2, 'Structure RTL - button panel child count'); + equal(panel.children().length, 2, 'Structure RTL - button panel child count'); ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button'); ok(panel.children(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button'); inp.datepicker('hide').datepicker('destroy'); @@ -200,24 +200,24 @@ test('customStructure', function() { inp.val('02/10/2008').focus(); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division'); - equals(header.children().length, 1, 'Structure hide prev/next - links child count'); + equal(header.children().length, 1, 'Structure hide prev/next - links child count'); ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division'); inp.datepicker('hide').datepicker('destroy'); - + // Changeable Month with read-only year inp = init('#inp', {changeMonth: true}); inp.focus(); var title = dp.children(':first').children(':last'); - equals(title.children().length, 2, 'Structure changeable month - title child count'); + equal(title.children().length, 2, 'Structure changeable month - title child count'); ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector'); ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year'); inp.datepicker('hide').datepicker('destroy'); - + // Changeable year with read-only month inp = init('#inp', {changeYear: true}); inp.focus(); var title = dp.children(':first').children(':last'); - equals(title.children().length, 2, 'Structure changeable year - title child count'); + equal(title.children().length, 2, 'Structure changeable year - title child count'); ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month'); ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector'); inp.datepicker('hide').datepicker('destroy'); @@ -226,8 +226,8 @@ test('customStructure', function() { inp = init('#inp', {changeFirstDay: false}); inp.focus(); var thead = dp.find('.ui-datepicker-calendar thead tr'); - equals(thead.children().length, 7, 'Structure read-only first day - thead child count'); - equals(thead.find('a').length, 0, 'Structure read-only first day - thead links count'); + equal(thead.children().length, 7, 'Structure read-only first day - thead child count'); + equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count'); inp.datepicker('hide').datepicker('destroy'); }); @@ -331,7 +331,7 @@ test('keystrokes', function() { inp.val('01/30/2008').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), + equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgdn - Feb'); inp.val('02/29/2008').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js index c7c16b610..fc312216f 100644 --- a/tests/unit/datepicker/datepicker_events.js +++ b/tests/unit/datepicker/datepicker_events.js @@ -27,24 +27,24 @@ test('events', function() { // onSelect inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(selectedThis, inp[0], 'Callback selected this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedThis, inp[0], 'Callback selected this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date'); inp.val('').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); date.setDate(date.getDate() + 7); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - ctrl+down'); inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - esc'); var dateStr = '02/04/2008'; inp.val(dateStr).datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(dateStr, selectedDate, + equal(dateStr, selectedDate, 'onSelect is called after enter keydown'); // onChangeMonthYear inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}). @@ -56,28 +56,28 @@ test('events', function() { date.setDate(1); inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 1); - equals(selectedThis, inp[0], 'Callback change month/year this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); - equals(selectedDate, newMonthYear(date), + equal(selectedThis, inp[0], 'Callback change month/year this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgup'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgdn'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); date.setFullYear(date.getFullYear() - 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgup'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}); date.setFullYear(date.getFullYear() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+home'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); date.setFullYear(date.getFullYear() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgdn'); inp.datepicker('setDate', new Date(2007, 1 - 1, 26)); - equals(selectedDate, '2007/1', 'Callback change month/year date - setDate'); + equal(selectedDate, '2007/1', 'Callback change month/year date - setDate'); selectedDate = null; inp.datepicker('setDate', new Date(2007, 1 - 1, 12)); ok(selectedDate == null, 'Callback change month/year date - setDate no change'); @@ -86,42 +86,42 @@ test('events', function() { datepicker('hide').val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 14); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgup'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 12); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgup'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 2); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgdn'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 12); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgdn'); // onClose inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}). val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedThis, inp[0], 'Callback close this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); - equals(selectedDate, '', 'Callback close date - esc'); + equal(selectedThis, inp[0], 'Callback close this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); + equal(selectedDate, '', 'Callback close date - esc'); inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), 'Callback close date - enter'); inp.val('02/04/2008').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedDate, '02/04/2008', 'Callback close date - preset'); + equal(selectedDate, '02/04/2008', 'Callback close date - preset'); inp.val('02/04/2008').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); - equals(selectedDate, '', 'Callback close date - ctrl+end'); + equal(selectedDate, '', 'Callback close date - ctrl+end'); var inp2 = init('#inp2'); inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show'); inp.datepicker('show'); - equals(selectedThis, inp2[0], 'Callback close this'); + equal(selectedThis, inp2[0], 'Callback close this'); }); })(jQuery); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 120a18c73..bab6ed45a 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -8,62 +8,62 @@ module("datepicker: options"); test('setDefaults', function() { var inp = init('#inp'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn'); $.datepicker.setDefaults({showOn: 'button'}); - equals($.datepicker._defaults.showOn, 'button', 'Change default showOn'); + equal($.datepicker._defaults.showOn, 'button', 'Change default showOn'); $.datepicker.setDefaults({showOn: 'focus'}); - equals($.datepicker._defaults.showOn, 'focus', 'Restore showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Restore showOn'); }); test('option', function() { var inp = init('#inp'); var inst = $.data(inp[0], PROP_NAME); // Set option - equals(inst.settings.showOn, null, 'Initial setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); + equal(inst.settings.showOn, null, 'Initial setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); inp.datepicker('option', 'showOn', 'button'); - equals(inst.settings.showOn, 'button', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'button', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('option', {showOn: 'both'}); - equals(inst.settings.showOn, 'both', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'both', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('option', 'showOn', undefined); - equals(inst.settings.showOn, null, 'Clear setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, null, 'Clear setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); // Get option inp = init('#inp'); - equals(inp.datepicker('option', 'showOn'), 'focus', 'Initial setting showOn'); + equal(inp.datepicker('option', 'showOn'), 'focus', 'Initial setting showOn'); inp.datepicker('option', 'showOn', 'button'); - equals(inp.datepicker('option', 'showOn'), 'button', 'Change instance showOn'); + equal(inp.datepicker('option', 'showOn'), 'button', 'Change instance showOn'); inp.datepicker('option', 'showOn', undefined); - equals(inp.datepicker('option', 'showOn'), 'focus', 'Reset instance showOn'); - same(inp.datepicker('option', 'all'), {showAnim: ''}, 'Get instance settings'); - same(inp.datepicker('option', 'defaults'), $.datepicker._defaults, + equal(inp.datepicker('option', 'showOn'), 'focus', 'Reset instance showOn'); + deepEqual(inp.datepicker('option', 'all'), {showAnim: ''}, 'Get instance settings'); + deepEqual(inp.datepicker('option', 'defaults'), $.datepicker._defaults, 'Get default settings'); }); test('change', function() { var inp = init('#inp'); var inst = $.data(inp[0], PROP_NAME); - equals(inst.settings.showOn, null, 'Initial setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); + equal(inst.settings.showOn, null, 'Initial setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); inp.datepicker('change', 'showOn', 'button'); - equals(inst.settings.showOn, 'button', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'button', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('change', {showOn: 'both'}); - equals(inst.settings.showOn, 'both', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'both', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('change', 'showOn', undefined); - equals(inst.settings.showOn, null, 'Clear setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, null, 'Clear setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); }); test('invocation', function() { @@ -91,7 +91,7 @@ test('invocation', function() { image = inp.siblings('img'); ok(button.length == 1, 'Button - button present'); ok(image.length == 0, 'Button - image absent'); - equals(button.text(), 'Popup', 'Button - button text'); + equal(button.text(), 'Popup', 'Button - button text'); inp.focus(); ok(!dp.is(':visible'), 'Button - not rendered on focus'); button.click(); @@ -107,8 +107,8 @@ test('invocation', function() { ok(button.length == 0, 'Image button - button absent'); image = inp.siblings('img'); ok(image.length == 1, 'Image button - image present'); - equals(image.attr('src'), 'img/calendar.gif', 'Image button - image source'); - equals(image.attr('title'), 'Cal', 'Image button - image text'); + equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source'); + equal(image.attr('title'), 'Cal', 'Image button - image text'); inp.focus(); ok(!dp.is(':visible'), 'Image button - not rendered on focus'); image.click(); @@ -140,19 +140,19 @@ test('otherMonths', function() { var inp = init('#inp'); var pop = $('#ui-datepicker-div'); inp.val('06/01/2009').datepicker('show'); - equals(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', + equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', 'Other months - none'); ok(pop.find('td:last *').length == 0, 'Other months - no content'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show'); - equals(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', + equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', 'Other months - show'); ok(pop.find('td:last span').length == 1, 'Other months - span content'); inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show'); - equals(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', + equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', 'Other months - select'); ok(pop.find('td:last a').length == 1, 'Other months - link content'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show'); - equals(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', + equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', 'Other months - none'); ok(pop.find('td:last *').length == 0, 'Other months - no content'); }); @@ -264,49 +264,49 @@ test('miscellaneous', function() { }; var curYear = new Date().getFullYear(); inp.val('02/04/2008').datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); + equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); inp.datepicker('hide').datepicker('option', {yearRange: 'c-6:c+2', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); inp.datepicker('hide').datepicker('option', {yearRange: '2000:2010', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010'); inp.datepicker('hide').datepicker('option', {yearRange: '-5:+3', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3'); + equal(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3'); inp.datepicker('hide').datepicker('option', {yearRange: '2000:-5', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5'); inp.datepicker('hide').datepicker('option', {yearRange: '', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2'); + equal(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2'); // Navigation as date format inp.datepicker('option', {showButtonPanel: true}); - equals(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default'); - equals(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default'); - equals(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default'); + equal(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default'); + equal(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default'); + equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default'); inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}). val('02/04/2008').datepicker('show'); var longNames = $.datepicker.regional[''].monthNames; var shortNames = $.datepicker.regional[''].monthNamesShort; var date = new Date(); - equals(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format'); + equal(dp.find('.ui-datepicker-current').text(), longNames[date.getMonth()], 'Navigation current - as date format'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); - equals(dp.find('.ui-datepicker-prev').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[1], 'Navigation prev - as date format + pgdn'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-current').text(), longNames[date.getMonth()], 'Navigation current - as date format + pgdn'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[3] + ' >', 'Navigation next - as date format + pgdn'); inp.datepicker('hide').datepicker('option', {gotoCurrent: true}). val('02/04/2008').datepicker('show'); - equals(dp.find('.ui-datepicker-prev').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format + goto current'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-current').text(), longNames[1], 'Navigation current - as date format + goto current'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format + goto current'); }); @@ -445,8 +445,8 @@ test('setDate', function() { inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}); date1 = new Date(2008, 6 - 1, 4); inp.datepicker('setDate', date1); - equals(inp.val(), '06/04/2008', 'Set date alternate - 06/04/2008'); - equals(alt.val(), '2008-06-04', 'Set date alternate - 2008-06-04'); + equal(inp.val(), '06/04/2008', 'Set date alternate - 06/04/2008'); + equal(alt.val(), '2008-06-04', 'Set date alternate - 2008-06-04'); // With minimum/maximum inp = init('#inp'); date1 = new Date(2008, 1 - 1, 4); @@ -468,7 +468,7 @@ test('setDate', function() { var dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0); var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0); inp.datepicker('setDate', dateAndTimeToSet); - equals(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate'); + equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate'); }); test('altField', function() { @@ -478,35 +478,35 @@ test('altField', function() { alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - enter'); - equals(alt.val(), '', 'Alt field - alt not set'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); + equal(alt.val(), '', 'Alt field - alt not set'); // Alternate field set alt.val(''); inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}). val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - enter'); - equals(alt.val(), '2008-06-04', 'Alt field - alt - enter'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); + equal(alt.val(), '2008-06-04', 'Alt field - alt - enter'); // Move from initial date alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); - equals(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); + equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); + equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); // Alternate field set - closed alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); - equals(alt.val(), '', 'Alt field - alt - pgdn/esc'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); + equal(alt.val(), '', 'Alt field - alt - pgdn/esc'); // Clear date and alternate alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); - equals(inp.val(), '', 'Alt field - dp - ctrl+end'); - equals(alt.val(), '', 'Alt field - alt - ctrl+end'); + equal(inp.val(), '', 'Alt field - dp - ctrl+end'); + equal(alt.val(), '', 'Alt field - alt - ctrl+end'); return // TODO manual entry impl works (see altField demo) but this test doesn't @@ -518,50 +518,50 @@ test('altField', function() { inp.simulate('keydown', {charCode: '8'.charCodeAt(0)}); inp.simulate('keypress', {charCode: '8'.charCodeAt(0)}); inp.simulate('keyup', {charCode: '8'.charCodeAt(0)}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - manual entry'); - equals(alt.val(), '2008-06-04', 'Alt field - manual entry'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - manual entry'); + equal(alt.val(), '2008-06-04', 'Alt field - manual entry'); // Verify alt field is not updated on keyup if date is invalid inp.val('12/04'); inp.simulate('keydown', {charCode: '/'.charCodeAt(0)}); inp.simulate('keypress', {charCode: '/'.charCodeAt(0)}); inp.simulate('keyup', {charCode: '/'.charCodeAt(0)}); - equals(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete'); - equals(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated'); + equal(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete'); + equal(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated'); }); test('autoSize', function() { var inp = init('#inp'); - equals(inp.prop('size'), 20, 'Auto size - default'); + equal(inp.prop('size'), 20, 'Auto size - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); + equal(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 15, 'Auto size - D M d yy'); + equal(inp.prop('size'), 15, 'Auto size - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); + equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); // French inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr'])); - equals(inp.prop('size'), 29, 'Auto size - fr - default'); + equal(inp.prop('size'), 29, 'Auto size - fr - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); + equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); + equal(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); + equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); // Hebrew inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he'])); - equals(inp.prop('size'), 28, 'Auto size - he - default'); + equal(inp.prop('size'), 28, 'Auto size - he - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); + equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 16, 'Auto size - he - D M d yy'); + equal(inp.prop('size'), 16, 'Auto size - he - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); + equal(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); }); test('daylightSaving', function() { @@ -571,79 +571,79 @@ test('daylightSaving', function() { // Australia, Sydney - AM change, southern hemisphere inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '04/05/2008', 'Daylight saving - Australia 04/05/2008'); + equal(inp.val(), '04/05/2008', 'Daylight saving - Australia 04/05/2008'); inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '04/06/2008', 'Daylight saving - Australia 04/06/2008'); + equal(inp.val(), '04/06/2008', 'Daylight saving - Australia 04/06/2008'); inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '04/07/2008', 'Daylight saving - Australia 04/07/2008'); + equal(inp.val(), '04/07/2008', 'Daylight saving - Australia 04/07/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '10/04/2008', 'Daylight saving - Australia 10/04/2008'); + equal(inp.val(), '10/04/2008', 'Daylight saving - Australia 10/04/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '10/05/2008', 'Daylight saving - Australia 10/05/2008'); + equal(inp.val(), '10/05/2008', 'Daylight saving - Australia 10/05/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '10/06/2008', 'Daylight saving - Australia 10/06/2008'); + equal(inp.val(), '10/06/2008', 'Daylight saving - Australia 10/06/2008'); // Brasil, Brasilia - midnight change, southern hemisphere inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(20) a', dp).simulate('click'); - equals(inp.val(), '02/16/2008', 'Daylight saving - Brasil 02/16/2008'); + equal(inp.val(), '02/16/2008', 'Daylight saving - Brasil 02/16/2008'); inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(21) a', dp).simulate('click'); - equals(inp.val(), '02/17/2008', 'Daylight saving - Brasil 02/17/2008'); + equal(inp.val(), '02/17/2008', 'Daylight saving - Brasil 02/17/2008'); inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(22) a', dp).simulate('click'); - equals(inp.val(), '02/18/2008', 'Daylight saving - Brasil 02/18/2008'); + equal(inp.val(), '02/18/2008', 'Daylight saving - Brasil 02/18/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click'); - equals(inp.val(), '10/11/2008', 'Daylight saving - Brasil 10/11/2008'); + equal(inp.val(), '10/11/2008', 'Daylight saving - Brasil 10/11/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click'); - equals(inp.val(), '10/12/2008', 'Daylight saving - Brasil 10/12/2008'); + equal(inp.val(), '10/12/2008', 'Daylight saving - Brasil 10/12/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click'); - equals(inp.val(), '10/13/2008', 'Daylight saving - Brasil 10/13/2008'); + equal(inp.val(), '10/13/2008', 'Daylight saving - Brasil 10/13/2008'); // Lebanon, Beirut - midnight change, northern hemisphere inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(34) a', dp).simulate('click'); - equals(inp.val(), '03/29/2008', 'Daylight saving - Lebanon 03/29/2008'); + equal(inp.val(), '03/29/2008', 'Daylight saving - Lebanon 03/29/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(35) a', dp).simulate('click'); - equals(inp.val(), '03/30/2008', 'Daylight saving - Lebanon 03/30/2008'); + equal(inp.val(), '03/30/2008', 'Daylight saving - Lebanon 03/30/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(36) a', dp).simulate('click'); - equals(inp.val(), '03/31/2008', 'Daylight saving - Lebanon 03/31/2008'); + equal(inp.val(), '03/31/2008', 'Daylight saving - Lebanon 03/31/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(27) a', dp).simulate('click'); - equals(inp.val(), '10/25/2008', 'Daylight saving - Lebanon 10/25/2008'); + equal(inp.val(), '10/25/2008', 'Daylight saving - Lebanon 10/25/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(28) a', dp).simulate('click'); - equals(inp.val(), '10/26/2008', 'Daylight saving - Lebanon 10/26/2008'); + equal(inp.val(), '10/26/2008', 'Daylight saving - Lebanon 10/26/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(29) a', dp).simulate('click'); - equals(inp.val(), '10/27/2008', 'Daylight saving - Lebanon 10/27/2008'); + equal(inp.val(), '10/27/2008', 'Daylight saving - Lebanon 10/27/2008'); // US, Eastern - AM change, northern hemisphere inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click'); - equals(inp.val(), '03/08/2008', 'Daylight saving - US 03/08/2008'); + equal(inp.val(), '03/08/2008', 'Daylight saving - US 03/08/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click'); - equals(inp.val(), '03/09/2008', 'Daylight saving - US 03/09/2008'); + equal(inp.val(), '03/09/2008', 'Daylight saving - US 03/09/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click'); - equals(inp.val(), '03/10/2008', 'Daylight saving - US 03/10/2008'); + equal(inp.val(), '03/10/2008', 'Daylight saving - US 03/10/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '11/01/2008', 'Daylight saving - US 11/01/2008'); + equal(inp.val(), '11/01/2008', 'Daylight saving - US 11/01/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '11/02/2008', 'Daylight saving - US 11/02/2008'); + equal(inp.val(), '11/02/2008', 'Daylight saving - US 11/02/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008'); + equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008'); }); var beforeShowThis = null; @@ -680,9 +680,9 @@ test('callbacks', function() { // Before show var inp = init('#inp', {beforeShow: beforeAll}); var inst = $.data(inp[0], 'datepicker'); - equals($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial'); + equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial'); inp.val('02/04/2008').datepicker('show'); - equals($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed'); + equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed'); ok(beforeShowThis.id == inp[0].id, 'Before show - this OK'); ok(beforeShowInput.id == inp[0].id, 'Before show - input OK'); deepEqual(beforeShowInst, inst, 'Before show - inst OK'); @@ -708,26 +708,26 @@ test('localisation', function() { var inp = init('#inp', $.datepicker.regional['fr']); inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show'); var dp = $('#ui-datepicker-div'); - equals($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close'); + equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close'); $('.ui-datepicker-close', dp).simulate('mouseover'); - equals($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous'); - equals($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current'); - equals($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next'); + equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous'); + equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current'); + equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next'); var month = 0; $('.ui-datepicker-month option', dp).each(function() { - equals($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month], + equal($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month], 'Localisation - month ' + month); month++; }); var day = 1; $('.ui-datepicker-calendar th', dp).each(function() { - equals($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day], + equal($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day], 'Localisation - day ' + day); day = (day + 1) % 7; }); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); var date = new Date(); - equals(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + + equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] + ' ' + date.getFullYear(), 'Localisation - formatting'); }); @@ -742,29 +742,29 @@ test('noWeekends', function() { test('iso8601Week', function() { var date = new Date(2000, 12 - 1, 31); - equals($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 1); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 7); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 8); - equals($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); date = new Date(2003, 12 - 1, 28); - equals($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); date = new Date(2003, 12 - 1, 29); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2004, 1 - 1, 4); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2004, 1 - 1, 5); - equals($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); date = new Date(2009, 12 - 1, 28); - equals($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 3); - equals($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 4); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 10); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); }); test('parseDate', function() { @@ -838,7 +838,7 @@ test('parseDateErrors', function() { ok(false, 'Parsed error ' + value); } catch (e) { - equals(e, error, 'Parsed error ' + value); + equal(e, error, 'Parsed error ' + value); } }; expectError(function() { $.datepicker.parseDate(null, 'Sat 2 01'); }, @@ -883,41 +883,41 @@ test('parseDateErrors', function() { test('formatDate', function() { init('#inp'); - equals($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)), '3 2 01', 'Format date d m y'); - equals($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)), '03 02 2001', 'Format date dd mm yy'); - equals($.datepicker.formatDate('d m y', new Date(2001, 12 - 1, 13)), + equal($.datepicker.formatDate('d m y', new Date(2001, 12 - 1, 13)), '13 12 01', 'Format date d m y'); - equals($.datepicker.formatDate('dd mm yy', new Date(2001, 12 - 1, 13)), + equal($.datepicker.formatDate('dd mm yy', new Date(2001, 12 - 1, 13)), '13 12 2001', 'Format date dd mm yy'); - equals($.datepicker.formatDate('yy-o', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('yy-o', new Date(2001, 2 - 1, 3)), '2001-34', 'Format date yy-o'); - equals($.datepicker.formatDate('yy-oo', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('yy-oo', new Date(2001, 2 - 1, 3)), '2001-034', 'Format date yy-oo'); - equals($.datepicker.formatDate('D M y', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('D M y', new Date(2001, 2 - 1, 3)), 'Sat Feb 01', 'Format date D M y'); - equals($.datepicker.formatDate('DD MM yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('DD MM yy', new Date(2001, 2 - 1, 3)), 'Saturday February 2001', 'Format date DD MM yy'); - equals($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 2 - 1, 3)), 'Saturday, February 3, 2001', 'Format date DD, MM d, yy'); - equals($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy', + equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy', new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001', 'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy'); var gmtDate = new Date(2001, 2 - 1, 3); gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset()); - equals($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @'); - equals($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !'); + equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @'); + equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !'); var fr = $.datepicker.regional['fr']; var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames, monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames}; - equals($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings), 'Lun. Avril 01', 'Format date D M y with settings'); - equals($.datepicker.formatDate('DD MM yy', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('DD MM yy', new Date(2001, 4 - 1, 9), settings), 'Lundi Avril 2001', 'Format date DD MM yy with settings'); - equals($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 4 - 1, 9), settings), 'Lundi, Avril 9, 2001', 'Format date DD, MM d, yy with settings'); - equals($.datepicker.formatDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy', + equal($.datepicker.formatDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy', new Date(2001, 4 - 1, 9), settings), 'jour 9 de Avril (\'Lundi\'), 2001', 'Format date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings'); }); diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js index 353426625..fcf712370 100644 --- a/tests/unit/datepicker/datepicker_tickets.js +++ b/tests/unit/datepicker/datepicker_tickets.js @@ -11,16 +11,16 @@ test('beforeShowDay-getDate', function() { var dp = $('#ui-datepicker-div'); inp.val('01/01/2010').datepicker('show'); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); + equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); $('a.ui-datepicker-next', dp).click(); $('a.ui-datepicker-next', dp).click(); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); + equal($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); inp.datepicker('hide').datepicker('show'); $('a.ui-datepicker-prev', dp).click(); $('a.ui-datepicker-prev', dp).click(); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); + equal($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); inp.datepicker('hide'); }); @@ -32,9 +32,9 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' }); var dp = $('#ui-datepicker-div'); inp.datepicker('show'); - equals(dp.css('display'), 'none',"beforeShow returns false"); + equal(dp.css('display'), 'none',"beforeShow returns false"); inp.datepicker('destroy'); - + inp = init('#inp',{ beforeShow: function(){ } @@ -44,7 +44,7 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' equal(dp.css('display'), 'block',"beforeShow returns nothing"); inp.datepicker('hide'); inp.datepicker('destroy'); - + inp = init('#inp',{ beforeShow: function(){ return true; @@ -58,8 +58,8 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' }); test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){ - var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); - equals(time, "089"); + var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); + equal(time, "089"); }); test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() { diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 2003689e9..4a671968e 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -42,7 +42,7 @@ function moved(dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) }; var expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) }; - same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldmove(why) { @@ -61,7 +61,7 @@ function resized(dw, dh, msg) { msg = msg ? msg + "." : ""; var actual = { width: widthAfter, height: heightAfter }; var expected = { width: widthBefore + dw, height: heightBefore + dh }; - same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldresize(why) { @@ -98,17 +98,17 @@ test("title id", function() { el = $('
    ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); el.remove(); el = $('
    ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); el.remove(); el = $('
    ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-foo', 'carried over title id'); + equal(titleId, 'ui-dialog-title-foo', 'carried over title id'); el.remove(); }); @@ -117,14 +117,14 @@ test("ARIA", function() { el = $('
    ').dialog(); - equals(dlg().attr('role'), 'dialog', 'dialog role'); + equal(dlg().attr('role'), 'dialog', 'dialog role'); var labelledBy = dlg().attr('aria-labelledby'); ok(labelledBy.length > 0, 'has aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-title').attr('id'), labelledBy, + equal(dlg().find('.ui-dialog-title').attr('id'), labelledBy, 'proper aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', + equal(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', 'close link role'); el.remove(); @@ -132,7 +132,7 @@ test("ARIA", function() { test("widget method", function() { var dialog = $("
    ").appendTo("#main").dialog(); - same(dialog.parent()[0], dialog.dialog("widget")[0]); + deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]); }); })(jQuery); diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 40a8575b6..4b769bafc 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -13,9 +13,9 @@ test("open", function() { open: function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'autoOpen: true fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }); el.remove(); @@ -25,15 +25,15 @@ test("open", function() { autoOpen: false, open: function(ev, ui) { ok(true, '.dialog("open") fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogopen', function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'dialog("open") fires open event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog("open"); el.remove(); @@ -45,14 +45,14 @@ test("dragStart", function() { el = $('
    ').dialog({ dragStart: function(ev, ui) { ok(true, 'dragging fires dragStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstart', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstart', function(ev, ui) { ok(true, 'dragging fires dialogdragstart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -64,22 +64,22 @@ test("dragStart", function() { test("drag", function() { expect(9); var hasDragged = false; - + el = $('
    ').dialog({ drag: function(ev, ui) { if (!hasDragged) { ok(true, 'dragging fires drag callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdrag', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdrag', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); - + hasDragged = true; } } }).one('dialogdrag', function(ev, ui) { ok(true, 'dragging fires dialogdrag event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -94,14 +94,14 @@ test("dragStop", function() { el = $('
    ').dialog({ dragStop: function(ev, ui) { ok(true, 'dragging fires dragStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstop', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstop', function(ev, ui) { ok(true, 'dragging fires dialogdragstop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -116,8 +116,8 @@ test("resizeStart", function() { el = $('
    ').dialog({ resizeStart: function(ev, ui) { ok(true, 'resizing fires resizeStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestart', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -125,7 +125,7 @@ test("resizeStart", function() { } }).bind('dialogresizestart', function(ev, ui) { ok(true, 'resizing fires dialogresizestart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -144,19 +144,19 @@ test("resize", function() { resize: function(ev, ui) { if (!hasResized) { ok(true, 'resizing fires resize callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresize', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresize', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.size !== undefined, "ui.size in callback"); - + hasResized = true; } } }).one('dialogresize', function(ev, ui) { ok(true, 'resizing fires dialogresize event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -173,8 +173,8 @@ test("resizeStop", function() { el = $('
    ').dialog({ resizeStop: function(ev, ui) { ok(true, 'resizing fires resizeStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestop', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -182,7 +182,7 @@ test("resizeStop", function() { } }).bind('dialogresizestop', function(ev, ui) { ok(true, 'resizing fires dialogresizestop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -199,14 +199,14 @@ test("close", function() { el = $('
    ').dialog({ close: function(ev, ui) { ok(true, '.dialog("close") fires close callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogclose', function(ev, ui) { ok(true, '.dialog("close") fires dialogclose event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog('close'); el.remove(); @@ -218,9 +218,9 @@ test("beforeClose", function() { el = $('
    ').dialog({ beforeClose: function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; } }); @@ -231,9 +231,9 @@ test("beforeClose", function() { el = $('
    ').dialog(); el.dialog('option', 'beforeClose', function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; }); el.dialog('close'); @@ -242,8 +242,8 @@ test("beforeClose", function() { el = $('
    ').dialog().bind('dialogbeforeclose', function(ev, ui) { ok(true, '.dialog("close") triggers dialogbeforeclose event'); - equals(this, el[0], "context of event"); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], "context of event"); + deepEqual(ui, {}, 'ui hash in event'); return false; }); el.dialog('close'); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index a961b4e03..645baa9f5 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -45,36 +45,36 @@ test("destroy", function() { var expected = $('
    ').dialog(), actual = expected.dialog('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
    ').dialog(), actual = expected.dialog('enable'); - equals(actual, expected, 'enable is chainable'); - + equal(actual, expected, 'enable is chainable'); + el = $('
    ').dialog({ disabled: true }); el.dialog('enable'); - equals(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); + equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); ok(!dlg().hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); }); test("disable", function() { var expected = $('
    ').dialog(), actual = expected.dialog('disable'); - equals(actual, expected, 'disable is chainable'); - + equal(actual, expected, 'disable is chainable'); + el = $('
    ').dialog({ disabled: false }); el.dialog('disable'); - equals(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); + equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); ok(dlg().hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); }); test("close", function() { var expected = $('
    ').dialog(), actual = expected.dialog('close'); - equals(actual, expected, 'close is chainable'); - + equal(actual, expected, 'close is chainable'); + el = $('
    ').dialog(); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog visible before close method called'); el.dialog('close'); @@ -85,22 +85,22 @@ test("isOpen", function() { expect(4); el = $('
    ').dialog(); - equals(el.dialog('isOpen'), true, "dialog is open after init"); + equal(el.dialog('isOpen'), true, "dialog is open after init"); el.dialog('close'); - equals(el.dialog('isOpen'), false, "dialog is closed"); + equal(el.dialog('isOpen'), false, "dialog is closed"); el.remove(); el = $('
    ').dialog({autoOpen: false}); - equals(el.dialog('isOpen'), false, "dialog is closed after init"); + equal(el.dialog('isOpen'), false, "dialog is closed after init"); el.dialog('open'); - equals(el.dialog('isOpen'), true, "dialog is open"); + equal(el.dialog('isOpen'), true, "dialog is open"); el.remove(); }); test("moveToTop", function() { var expected = $('
    ').dialog(), actual = expected.dialog('moveToTop'); - equals(actual, expected, 'moveToTop is chainable'); + equal(actual, expected, 'moveToTop is chainable'); var d1 = $('
    ').dialog(), dlg1 = d1.parents('.ui-dialog'); d1.dialog('close'); @@ -116,7 +116,7 @@ test("moveToTop", function() { test("open", function() { var expected = $('
    ').dialog(), actual = expected.dialog('open'); - equals(actual, expected, 'open is chainable'); + equal(actual, expected, 'open is chainable'); el = $('
    ').dialog({ autoOpen: false }); ok(dlg().is(':hidden') && !dlg().is(':visible'), 'dialog hidden before open method called'); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 264c2fb6e..10443892b 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -23,58 +23,58 @@ test("buttons", function() { var buttons = { "Ok": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); }, "Cancel": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[1], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[1], "event target"); } }; el = $('
    ').dialog({ buttons: buttons }); var btn = $("button", dlg()); - equals(btn.length, 2, "number of buttons"); + equal(btn.length, 2, "number of buttons"); var i = 0; $.each(buttons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i++; }); ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container"); ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons"); - + btn.trigger("click"); var newButtons = { "Close": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); } }; - same(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); + deepEqual(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); el.dialog("option", "buttons", newButtons); - same(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); + deepEqual(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); btn = $("button", dlg()); - equals(btn.length, 1, "number of buttons after setter"); + equal(btn.length, 1, "number of buttons after setter"); btn.trigger('click'); i = 0; $.each(newButtons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i += 1; }); - + el.dialog("option", "buttons", null); btn = $("button", dlg()); - equals(btn.length, 0, "all buttons have been removed"); - equals(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); - equals(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); + equal(btn.length, 0, "all buttons have been removed"); + equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); + equal(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); el.remove(); }); @@ -89,15 +89,15 @@ test("buttons - advanced", function() { "class": "additional-class", id: "my-button-id", click: function() { - equals(this, el[0], "correct context"); + equal(this, el[0], "correct context"); } } ] }); var buttons = dlg().find("button"); - equals(buttons.length, 1, "correct number of buttons"); - equals(buttons.attr("id"), "my-button-id", "correct id"); - equals(buttons.text(), "a button", "correct label"); + equal(buttons.length, 1, "correct number of buttons"); + equal(buttons.attr("id"), "my-button-id", "correct id"); + equal(buttons.text(), "a button", "correct label"); ok(buttons.hasClass("additional-class"), "additional classes added"); buttons.click(); @@ -112,9 +112,9 @@ test("closeOnEscape", function() { .simulate('keypress', { keyCode: $.ui.keyCode.ESCAPE }) .simulate('keyup', { keyCode: $.ui.keyCode.ESCAPE }); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open after ESC'); - + el.remove(); - + el = $('
    ').dialog({ closeOnEscape: true }); ok(true, 'closeOnEscape: true'); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open before ESC'); @@ -128,17 +128,17 @@ test("closeText", function() { expect(3); el = $('
    ').dialog(); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', 'default close text'); el.remove(); el = $('
    ').dialog({ closeText: "foo" }); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', 'closeText on init'); el.remove(); el = $('
    ').dialog().dialog('option', 'closeText', 'bar'); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', 'closeText via option method'); el.remove(); }); @@ -147,16 +147,16 @@ test("dialogClass", function() { expect(4); el = $('
    ').dialog(); - equals(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); + equal(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); el.remove(); el = $('
    ').dialog({ dialogClass: "foo" }); - equals(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); el.remove(); el = $('
    ').dialog({ dialogClass: "foo bar" }); - equals(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); - equals(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); + equal(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); el.remove(); }); @@ -180,21 +180,21 @@ test("height", function() { expect(4); el = $('
    ').dialog(); - equals(dlg().outerHeight(), 150, "default height"); + equal(dlg().outerHeight(), 150, "default height"); el.remove(); el = $('
    ').dialog({ height: 237 }); - equals(dlg().outerHeight(), 237, "explicit height"); + equal(dlg().outerHeight(), 237, "explicit height"); el.remove(); el = $('
    ').dialog(); el.dialog('option', 'height', 238); - equals(dlg().outerHeight(), 238, "explicit height set after init"); + equal(dlg().outerHeight(), 238, "explicit height set after init"); el.remove(); - + el = $('
    ').css("padding", "20px") .dialog({ height: 240 }); - equals(dlg().outerHeight(), 240, "explicit height with padding"); + equal(dlg().outerHeight(), 240, "explicit height with padding"); el.remove(); }); @@ -203,17 +203,17 @@ test("maxHeight", function() { el = $('
    ').dialog({ maxHeight: 200 }); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('
    ').dialog({ maxHeight: 200 }); drag('.ui-resizable-n', -1000, -1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('
    ').dialog({ maxHeight: 200 }).dialog('option', 'maxHeight', 300); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 300, "maxHeight"); + equal(heightAfter, 300, "maxHeight"); el.remove(); }); @@ -222,17 +222,17 @@ test("maxWidth", function() { el = $('
    ').dialog({ maxWidth: 200 }); drag('.ui-resizable-e', 1000, 1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('
    ').dialog({ maxWidth: 200 }); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('
    ').dialog({ maxWidth: 200 }).dialog('option', 'maxWidth', 300); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 300, "maxWidth"); + equal(widthAfter, 300, "maxWidth"); el.remove(); }); @@ -241,17 +241,17 @@ test("minHeight", function() { el = $('
    ').dialog({ minHeight: 10 }); drag('.ui-resizable-s', -1000, -1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('
    ').dialog({ minHeight: 10 }); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('
    ').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 30, "minHeight"); + equal(heightAfter, 30, "minHeight"); el.remove(); }); @@ -260,17 +260,17 @@ test("minWidth", function() { el = $('
    ').dialog({ minWidth: 10 }); drag('.ui-resizable-e', -1000, -1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('
    ').dialog({ minWidth: 10 }); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('
    ').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 30, "minWidth"); + equal(widthAfter, 30, "minWidth"); el.remove(); }); @@ -278,8 +278,8 @@ test("position, default center on window", function() { var el = $('
    ').dialog(); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -287,8 +287,8 @@ test("position, top on window", function() { var el = $('
    ').dialog({ position: "top" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, $(window).scrollTop()); el.remove(); }); @@ -296,8 +296,8 @@ test("position, left on window", function() { var el = $('
    ').dialog({ position: "left" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 0); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, 0); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -305,8 +305,8 @@ test("position, right bottom on window", function() { var el = $('
    ').dialog({ position: "right bottom" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -314,8 +314,8 @@ test("position, right bottom on window w/array", function() { var el = $('
    ').dialog({ position: ["right", "bottom"] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -323,8 +323,8 @@ test("position, offset from top left w/array", function() { var el = $('
    ').dialog({ position: [10, 10] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 10 + $(window).scrollLeft()); - same(offset.top, 10 + $(window).scrollTop()); + deepEqual(offset.left, 10 + $(window).scrollLeft()); + deepEqual(offset.top, 10 + $(window).scrollTop()); el.remove(); }); @@ -339,8 +339,8 @@ test("position, right bottom at right bottom via ui.position args", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -364,8 +364,8 @@ test("position, at another element", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 600); - same(offset.top, 400); + deepEqual(offset.left, 600); + deepEqual(offset.top, 400); el.dialog('option', 'position', { my: "left top", @@ -375,8 +375,8 @@ test("position, at another element", function() { var offset = dialog.offset(); - same(offset.left, 610); - same(offset.top, 410); + deepEqual(offset.left, 610); + deepEqual(offset.top, 410); el.remove(); parent.remove(); @@ -408,27 +408,27 @@ test("title", function() { el = $('
    ').dialog(); // some browsers return a non-breaking space and some return " " // so we get the text to normalize to the actual non-breaking space - equals(dlg().find(".ui-dialog-title").text(), " ", "[default]"); - equals(el.dialog("option", "title"), "", "option not changed"); + equal(dlg().find(".ui-dialog-title").text(), " ", "[default]"); + equal(el.dialog("option", "title"), "", "option not changed"); el.remove(); el = $('
    ').dialog(); - equals(titleText(), "foo", "title in element attribute"); - equals(el.dialog("option", "title"), "foo", "option updated from attribute"); + equal(titleText(), "foo", "title in element attribute"); + equal(el.dialog("option", "title"), "foo", "option updated from attribute"); el.remove(); el = $('
    ').dialog({ title: 'foo' }); - equals(titleText(), "foo", "title in init options"); - equals(el.dialog("option", "title"), "foo", "opiton set from options hash"); + equal(titleText(), "foo", "title in init options"); + equal(el.dialog("option", "title"), "foo", "opiton set from options hash"); el.remove(); el = $('
    ').dialog({ title: 'bar' }); - equals(titleText(), "bar", "title in init options should override title in element attribute"); - equals(el.dialog("option", "title"), "bar", "opiton set from options hash"); + equal(titleText(), "bar", "title in init options should override title in element attribute"); + equal(el.dialog("option", "title"), "bar", "opiton set from options hash"); el.remove(); el = $('
    ').dialog().dialog('option', 'title', 'foo'); - equals(titleText(), 'foo', 'title after init'); + equal(titleText(), 'foo', 'title after init'); el.remove(); }); @@ -436,13 +436,13 @@ test("width", function() { expect(3); el = $('
    ').dialog(); - equals(dlg().width(), 300, "default width"); + equal(dlg().width(), 300, "default width"); el.remove(); el = $('
    ').dialog({width: 437 }); - equals(dlg().width(), 437, "explicit width"); + equal(dlg().width(), 437, "explicit width"); el.dialog('option', 'width', 438); - equals(dlg().width(), 438, 'explicit width after init'); + equal(dlg().width(), 438, 'explicit width after init'); el.remove(); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index f8ab8b423..bd9056153 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -41,7 +41,7 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldnotresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('open'); - shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); + shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); } el.remove(); @@ -49,10 +49,10 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('option', 'resizable', false).dialog('open'); - shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); + shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); } el.remove(); - + }); test("#5184: isOpen in dialogclose event is true", function() { @@ -75,11 +75,11 @@ test("#5531: dialog width should be at least minWidth on creation", function () minWidth: 300 }); - equals(el.dialog('option', 'width'), 300, "width is minWidth"); + equal(el.dialog('option', 'width'), 300, "width is minWidth"); el.dialog('option', 'width', 200); - equals(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); + equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); el.dialog('option', 'width', 320); - equals(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); + equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); el.remove(); el = $('
    ').dialog({ @@ -109,9 +109,9 @@ test("#6645: Missing element not found check in overlay", function(){ expect(2); d1 = $('
    Dialog 1
    ').dialog({modal: true}); d2 = $('
    Dialog 2
    ').dialog({modal: true, close: function(){ d2.remove()}}); - equals($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); + equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); d2.dialog('close'); - equals($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); + equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); d1.add(d2).remove(); }); diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index a01de408f..ba5bc4c66 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -19,7 +19,7 @@ var moved = function (dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: offsetAfter.left, top: offsetAfter.top }; var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy }; - same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function restoreScroll(what) { diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js index d92d8ee12..85ba824d8 100644 --- a/tests/unit/draggable/draggable_events.js +++ b/tests/unit/draggable/draggable_events.js @@ -18,9 +18,9 @@ test("callbacks occurance count", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 3, "drag callback should happen exactly once per mousemove"); - equals(stop, 1, "stop callback should happen exactly once"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 3, "drag callback should happen exactly once per mousemove"); + equal(stop, 1, "stop callback should happen exactly once"); }); @@ -37,9 +37,9 @@ test("stopping the start callback", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 0, "drag callback should not happen at all"); - equals(stop, 0, "stop callback should not happen if there wasnt even a start"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 0, "drag callback should not happen at all"); + equal(stop, 0, "stop callback should not happen if there wasnt even a start"); }); @@ -56,9 +56,9 @@ test("stopping the drag callback", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 1, "drag callback should happen exactly once"); - equals(stop, 1, "stop callback should happen, as we need to actively stop the drag"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 1, "drag callback should happen exactly once"); + equal(stop, 1, "stop callback should happen, as we need to actively stop the drag"); }); diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js index 4ffadf09e..bb3fd0771 100644 --- a/tests/unit/draggable/draggable_methods.js +++ b/tests/unit/draggable/draggable_methods.js @@ -52,7 +52,7 @@ test("destroy", function() { var expected = $('
    ').draggable(), actual = expected.draggable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -61,18 +61,18 @@ test("enable", function() { shouldnotmove('.draggable({ disabled: true })'); el.draggable("enable"); shouldmove('.draggable("enable")'); - equals(el.draggable("option", "disabled"), false, "disabled option getter"); + equal(el.draggable("option", "disabled"), false, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: true }); shouldnotmove('.draggable({ disabled: true })'); el.draggable("option", "disabled", false); - equals(el.draggable("option", "disabled"), false, "disabled option setter"); + equal(el.draggable("option", "disabled"), false, "disabled option setter"); shouldmove('.draggable("option", "disabled", false)'); - + var expected = $('
    ').draggable(), actual = expected.draggable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -81,19 +81,19 @@ test("disable", function() { shouldmove('.draggable({ disabled: false })'); el.draggable("disable"); shouldnotmove('.draggable("disable")'); - equals(el.draggable("option", "disabled"), true, "disabled option getter"); + equal(el.draggable("option", "disabled"), true, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: false }); shouldmove('.draggable({ disabled: false })'); el.draggable("option", "disabled", true); - equals(el.draggable("option", "disabled"), true, "disabled option setter"); + equal(el.draggable("option", "disabled"), true, "disabled option setter"); shouldnotmove('.draggable("option", "disabled", true)'); - + var expected = $('
    ').draggable(), actual = expected.draggable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index 8ba77fb93..d5f85feab 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -24,7 +24,7 @@ var margin = function(el, side) { return parseInt(el.css('margin-' + side)); } module("draggable: options"); test("{ addClasses: true }, default", function() { - equals(draggable_defaults.addClasses, true); + equal(draggable_defaults.addClasses, true); el = $("
    ").draggable({ addClasses: true }); ok(el.is(".ui-draggable"), "'ui-draggable' class added"); @@ -40,12 +40,12 @@ test("{ addClasses: false }", function() { }); test("{ appendTo: 'parent' }, default", function() { - equals(draggable_defaults.appendTo, "parent"); + equal(draggable_defaults.appendTo, "parent"); el = $("#draggable2").draggable({ appendTo: 'parent' }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: 'parent' }); drag(el, 50, 50); moved(50, 50); @@ -56,7 +56,7 @@ test("{ appendTo: Element }", function() { el = $("#draggable2").draggable({ appendTo: $("#draggable2").parent()[0] }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: $("#draggable2").parent()[0] }); drag(el, 50, 50); moved(50, 50); @@ -66,14 +66,14 @@ test("{ appendTo: Selector }", function() { el = $("#draggable2").draggable({ appendTo: "#main" }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: "#main" }); drag(el, 50, 50); moved(50, 50); }); test("{ axis: false }, default", function() { - equals(draggable_defaults.axis, false); + equal(draggable_defaults.axis, false); el = $("#draggable2").draggable({ axis: false }); drag(el, 50, 50); @@ -110,7 +110,7 @@ test("{ axis: ? }, unexpected", function() { }); test("{ cancel: ':input,option' }, default", function() { - equals(draggable_defaults.cancel, ":input,option"); + equal(draggable_defaults.cancel, ":input,option"); $('
    ').appendTo('#main'); @@ -159,7 +159,7 @@ test("{ cancel: ? }, unexpected", function() { }); test("{ containment: false }, default", function() { - equals(draggable_defaults.containment, false); + equal(draggable_defaults.containment, false); ok(false, 'missing test - untested code is broken code'); }); @@ -176,7 +176,7 @@ test("{ containment: 'parent' }, relative", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - same(offsetAfter, expected, 'compare offset to parent'); + deepEqual(offsetAfter, expected, 'compare offset to parent'); }); test("{ containment: 'parent' }, absolute", function() { @@ -187,7 +187,7 @@ test("{ containment: 'parent' }, absolute", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - same(offsetAfter, expected, 'compare offset to parent'); + deepEqual(offsetAfter, expected, 'compare offset to parent'); }); test("{ containment: 'document' }", function() { @@ -207,7 +207,7 @@ test("{ containment: [x1, y1, x2, y2] }", function() { }); test("{ cursor: 'auto' }, default", function() { - equals(draggable_defaults.cursor, 'auto'); + equal(draggable_defaults.cursor, 'auto'); function getCursor() { return $("#draggable2").css("cursor"); } @@ -226,8 +226,8 @@ test("{ cursor: 'auto' }, default", function() { drag("#draggable2", -1, -1); after = getCursor(); - equals(actual, expected, "start callback: cursor '" + expected + "'"); - equals(after, before, "after drag: cursor restored"); + equal(actual, expected, "start callback: cursor '" + expected + "'"); + equal(after, before, "after drag: cursor restored"); }); @@ -250,13 +250,13 @@ test("{ cursor: 'move' }", function() { drag("#draggable2", -1, -1); after = getCursor(); - equals(actual, expected, "start callback: cursor '" + expected + "'"); - equals(after, before, "after drag: cursor restored"); + equal(actual, expected, "start callback: cursor '" + expected + "'"); + equal(after, before, "after drag: cursor restored"); }); test("{ cursorAt: false}, default", function() { - equals(draggable_defaults.cursorAt, false); + equal(draggable_defaults.cursorAt, false); ok(false, 'missing test - untested code is broken code'); }); @@ -272,8 +272,8 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -305,8 +305,8 @@ test("{ cursorAt: { right: 10, bottom: 20 } }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { right: cursorAtX, bottom: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -338,8 +338,8 @@ test("{ cursorAt: [10, 20] }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -371,8 +371,8 @@ test("{ cursorAt: '20, 40' }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -446,58 +446,58 @@ test("{ helper: 'clone' }, absolute", function() { }); test("{ helper: 'original' }, relative, with scroll offset on parent", function() { - + el = $("#draggable1").draggable({ helper: "original" }); setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); restoreScroll(); - + }); test("{ helper: 'original' }, relative, with scroll offset on root", function() { - + el = $("#draggable1").draggable({ helper: "original" }); - + setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); restoreScroll('root'); - + }); test("{ helper: 'original' }, relative, with scroll offset on root and parent", function() { - + el = $("#draggable1").draggable({ helper: "original" }); - + setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); restoreScroll(); restoreScroll('root'); - + }); test("{ helper: 'original' }, absolute, with scroll offset on parent", function() { @@ -506,10 +506,10 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function( setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); @@ -520,18 +520,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function( test("{ helper: 'original' }, absolute, with scroll offset on root", function() { el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" }); - + setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); restoreScroll('root'); - + }); test("{ helper: 'original' }, absolute, with scroll offset on root and parent", function() { @@ -541,18 +541,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on root and parent", setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); restoreScroll(); restoreScroll('root'); - + }); test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { @@ -561,10 +561,10 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); @@ -573,15 +573,15 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { }); test("{ helper: 'original' }, fixed, with scroll offset on root", function() { - + el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" }); setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); @@ -595,15 +595,15 @@ test("{ helper: 'original' }, fixed, with scroll offset on root and parent", fun setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); - + restoreScroll(); restoreScroll('root'); @@ -619,7 +619,7 @@ test("{ helper: 'clone' }, absolute", function() { } }); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); }); @@ -636,18 +636,18 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() { $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll(); }); @@ -661,22 +661,22 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() { el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) { helperOffset = ui.helper.offset(); } }); - + $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll('root'); }); @@ -695,18 +695,18 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll('root'); restoreScroll(); @@ -726,7 +726,7 @@ test("{ opacity: 0.5 }", function() { drag("#draggable2", -1, -1); - equals(opacity, 0.5, "start callback: opacity is"); + equal(opacity, 0.5, "start callback: opacity is"); }); @@ -746,7 +746,7 @@ test("{ zIndex: 10 }", function() { drag("#draggable2", -1, -1); - equals(actual, expected, "start callback: zIndex is"); + equal(actual, expected, "start callback: zIndex is"); }); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index 87b916888..8fd49d265 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -39,10 +39,10 @@ test("destroy", function() { $("
    ").droppable().droppable("destroy").droppable("foo"); ok(true, 'arbitrary method called after destroy'); - + var expected = $('
    ').droppable(), actual = expected.droppable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -51,17 +51,17 @@ test("enable", function() { shouldNotBeDroppable(); el.droppable("enable"); shouldBeDroppable(); - equals(el.droppable("option", "disabled"), false, "disabled option getter"); + equal(el.droppable("option", "disabled"), false, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: true }); shouldNotBeDroppable(); el.droppable("option", "disabled", false); - equals(el.droppable("option", "disabled"), false, "disabled option setter"); + equal(el.droppable("option", "disabled"), false, "disabled option setter"); shouldBeDroppable(); - + var expected = $('
    ').droppable(), actual = expected.droppable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -70,17 +70,17 @@ test("disable", function() { shouldBeDroppable(); el.droppable("disable"); shouldNotBeDroppable(); - equals(el.droppable("option", "disabled"), true, "disabled option getter"); + equal(el.droppable("option", "disabled"), true, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: false }); shouldBeDroppable(); el.droppable("option", "disabled", true); - equals(el.droppable("option", "disabled"), true, "disabled option setter"); + equal(el.droppable("option", "disabled"), true, "disabled option setter"); shouldNotBeDroppable(); - + var expected = $('
    ').droppable(), actual = expected.droppable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/droppable/droppable_options.js b/tests/unit/droppable/droppable_options.js index 2f2dbf673..4df2d9ecb 100644 --- a/tests/unit/droppable/droppable_options.js +++ b/tests/unit/droppable/droppable_options.js @@ -6,7 +6,7 @@ module("droppable: options"); test("{ accept '*' }, default ", function() { - equals(droppable_defaults.accept, '*'); + equal(droppable_defaults.accept, '*'); ok(false, 'missing test - untested code is broken code'); }); @@ -24,7 +24,7 @@ test("activeClass", function() { }); test("{ addClasses: true }, default", function() { - equals(droppable_defaults.addClasses, true); + equal(droppable_defaults.addClasses, true); el = $("
    ").droppable({ addClasses: true }); ok(el.is(".ui-droppable"), "'ui-droppable' class added"); diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index bccf4a1f2..02e3be3be 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -13,16 +13,16 @@ test("accessibility", function () { var item0 = $("li:eq(0) a"); ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class"); - equals( menu.attr("role"), "menu", "main role"); + equal( menu.attr("role"), "menu", "main role"); ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active"); var item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end(); menu.menu( "focus", $.Event(), item ); - equals( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); + equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); var item = menu.find( "li:last" ); menu.menu( "focus", $.Event(), item ); - equals( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id"); + equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id"); }); test("items class and role", function () { @@ -31,10 +31,10 @@ test("items class and role", function () { ok( ($("li",menu).length > 0 ), "number of menu items"); $("li",menu).each(function(item) { ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item"); - equals( $(this).attr("role"), "presentation", "menu item ("+ item + ") role"); - equals( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role"); + equal( $(this).attr("role"), "presentation", "menu item ("+ item + ") role"); + equal( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role"); ok( $("a",this).hasClass("ui-corner-all"), "a element class for menu item ("+ item + ") "); - equals( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") "); + equal( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") "); }); }); diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 6b03efb3c..bee6fcfa6 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -18,7 +18,7 @@ test("handle click on menu", function() { menu_click( menu,"2"); menu_click($('#menu1'),"3"); menu_click( menu,"1"); - equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); }); test("handle click on custom item menu", function() { @@ -35,10 +35,10 @@ test("handle click on custom item menu", function() { menu_click( menu,"2"); menu_click($('#menu5'),"3"); menu_click( menu,"1"); - equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); }); -/* Commenting out these tests until a way to handle the extra focus and blur events +/* Commenting out these tests until a way to handle the extra focus and blur events fired by IE is found test( "handle blur: click", function() { expect( 4 ); @@ -154,51 +154,51 @@ test("handle keyboard navigation on menu without scroll and without submenus", f element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "1,keydown,", "Keydown UP"); + equal( $("#log").html(), "1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); - equals( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "4,keydown,", "Keydown END"); + equal( $("#log").html(), "4,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); }); asyncTest("handle keyboard navigation on menu without scroll and with submenus", function() { @@ -216,7 +216,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", element.one( "menufocus", function( event, ui ) { element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); setTimeout( menukeyboard1, 50 ); }); element.focus(); @@ -225,11 +225,11 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); @@ -239,7 +239,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); setTimeout( function() { - equals( $("#log").html(), "0,4,3,2,1,keydown,", "Keydown RIGHT (open submenu)"); + equal( $("#log").html(), "0,4,3,2,1,keydown,", "Keydown RIGHT (open submenu)"); }, 50); setTimeout( menukeyboard2, 50 ); } @@ -247,7 +247,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", function menukeyboard2() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)"); + equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)"); //re-open submenu element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); @@ -257,31 +257,31 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", function menukeyboard3() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "2,keydown,", "Keydown END"); + equal( $("#log").html(), "2,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)"); + equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); @@ -289,11 +289,11 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", } function menukeyboard4() { - equals( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); + equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)"); + equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)"); start(); } @@ -314,60 +314,60 @@ test("handle keyboard navigation on menu with scroll and without submenus", func element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); - equals( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "37,keydown,", "Keydown END"); + equal( $("#log").html(), "37,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); }); asyncTest("handle keyboard navigation on menu with scroll and with submenus", function() { @@ -385,28 +385,28 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu element.one( "menufocus", function( event, ui ) { element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); setTimeout( menukeyboard1, 50 ); }); element.focus(); - + function menukeyboard1() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); setTimeout( function() { - equals( $("#log").html(), "0,1,keydown,", "Keydown RIGHT (open submenu)"); + equal( $("#log").html(), "0,1,keydown,", "Keydown RIGHT (open submenu)"); }, 50); setTimeout( menukeyboard2, 50 ); } @@ -414,7 +414,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu function menukeyboard2() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)"); + equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)"); //re-open submenu element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); @@ -424,31 +424,31 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu function menukeyboard3() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "27,keydown,", "Keydown END"); + equal( $("#log").html(), "27,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)"); + equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); @@ -456,11 +456,11 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu } function menukeyboard4() { - equals( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); + equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)"); start(); } diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index 3bcab3361..200ea4427 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -22,17 +22,17 @@ test( "enable/disable", function() { menu_log("click"); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid."); }); test( "refresh", function() { expect( 3 ); var menu = $( "#menu1" ).menu(); - equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); menu.append("
  1. test item
  2. ").menu("refresh"); - equals(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items"); menu.find(".ui-menu-item:last").remove().end().menu("refresh"); - equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); }); test("destroy", function() { diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index 479aab0d1..cda52d88d 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -17,7 +17,7 @@ test( "{ disabled: true }", function() { menu_log("click",true); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,click,", "Click order not valid."); }); test( "{ disabled: false }", function() { @@ -32,7 +32,7 @@ test( "{ disabled: false }", function() { menu_log("click",true); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,1,click,", "Click order not valid."); }); })(jQuery); diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index ea1baee72..fbcac4b7f 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -14,7 +14,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "left top, left top" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "left top, left top" ); $( "#elx" ).position({ my: "left top", @@ -22,7 +22,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 60, left: 40 }, "left top, left bottom" ); + deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "left top, left bottom" ); $( "#elx" ).position({ my: "left", @@ -30,7 +30,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 55, left: 50 }, "left, bottom" ); + deepEqual( $( "#elx" ).offset(), { top: 55, left: 50 }, "left, bottom" ); $( "#elx" ).position({ my: "left foo", @@ -38,7 +38,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 45, left: 50 }, "left foo, bar baz" ); + deepEqual( $( "#elx" ).offset(), { top: 45, left: 50 }, "left foo, bar baz" ); }); test( "multiple elements", function() { @@ -50,10 +50,10 @@ test( "multiple elements", function() { collision: "none" }); - same( result, elements ); + deepEqual( result, elements ); var expected = { top: 10, left: 4 }; elements.each(function() { - same( $( this ).offset(), expected ); + deepEqual( $( this ).offset(), expected ); }); }); @@ -89,7 +89,7 @@ test( "positions", function() { of: "#parent", collision: "none" }); - same( el.offset(), definition.result, + deepEqual( el.offset(), definition.result, "Position via " + QUnit.jsDump.parse({ my:definition.my, at:definition.at }) ); }); }); @@ -101,7 +101,7 @@ test( "of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "selector" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "selector" ); $( "#elx" ).position({ my: "left top", @@ -109,7 +109,7 @@ test( "of", function() { of: $( "#parentx"), collision: "none" }); - same( $( "#elx" ).offset(), { top: 60, left: 40 }, "jQuery object" ); + deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "jQuery object" ); $( "#elx" ).position({ my: "left top", @@ -117,7 +117,7 @@ test( "of", function() { of: $( "#parentx" )[ 0 ], collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "DOM element" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "DOM element" ); $( "#elx" ).position({ my: "right bottom", @@ -125,7 +125,7 @@ test( "of", function() { of: document, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( document ).height() - 10, left: $( document ).width() - 10 }, "document" ); @@ -136,7 +136,7 @@ test( "of", function() { of: $( document ), collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( document ).height() - 10, left: $( document ).width() - 10 }, "document as jQuery object" ); @@ -149,7 +149,7 @@ test( "of", function() { of: window, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "window" ); @@ -160,7 +160,7 @@ test( "of", function() { of: $( window ), collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "window as jQuery object" ); @@ -173,7 +173,7 @@ test( "of", function() { of: window, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() + 500 - 10, left: $( window ).width() + 200 - 10 }, "window, scrolled" ); @@ -187,7 +187,7 @@ test( "of", function() { of: event, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 300, left: 200 }, "event - left top, left top" ); @@ -199,7 +199,7 @@ test( "of", function() { of: event, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 600, left: 400 }, "event - left top, right bottom" ); @@ -212,7 +212,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 70, left: 50 }, "offsets in at" ); + deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "offsets in at" ); $( "#elx" ).position({ my: "left+10 top-10", @@ -220,7 +220,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 50, left: 50 }, "offsets in my" ); + deepEqual( $( "#elx" ).offset(), { top: 50, left: 50 }, "offsets in my" ); $( "#elx" ).position({ my: "left top", @@ -228,7 +228,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 58, left: 50 }, "percentage offsets in at" ); + deepEqual( $( "#elx" ).offset(), { top: 58, left: 50 }, "percentage offsets in at" ); $( "#elx" ).position({ my: "left-30% top+50%", @@ -236,7 +236,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" ); + deepEqual( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" ); }); test( "using", function() { @@ -257,14 +257,14 @@ test( "using", function() { at: "left top", of: "#parentx", using: function( position ) { - same( this, elems[ count ], "correct context for call #" + count ); - same( position, expectedPosition, "correct position for call #" + count ); + deepEqual( this, elems[ count ], "correct context for call #" + count ); + deepEqual( position, expectedPosition, "correct position for call #" + count ); count++; } }); elems.each(function() { - same( $( this ).offset(), originalPosition, "elements not moved" ); + deepEqual( $( this ).offset(), originalPosition, "elements not moved" ); }); }); @@ -274,7 +274,7 @@ function collisionTest( config, result, msg ) { at: "right bottom", of: window }, config ) ); - same( elem.offset(), result, msg ); + deepEqual( elem.offset(), result, msg ); } function collisionTest2( config, result, msg ) { @@ -443,7 +443,7 @@ test( "addClass: flipped left", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); elem.position( { my: "right center", @@ -452,7 +452,7 @@ test( "addClass: flipped left", function() { at: "left center" }) - same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); }); test( "addClass: flipped top", function() { @@ -463,7 +463,7 @@ test( "addClass: flipped top", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); elem.position( { my: "left bottom", @@ -472,7 +472,7 @@ test( "addClass: flipped top", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); }); test( "addClass: flipped right", function() { @@ -483,7 +483,7 @@ test( "addClass: flipped right", function() { at: "left center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); elem.position( { my: "left center", @@ -492,7 +492,7 @@ test( "addClass: flipped right", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); }); @@ -504,7 +504,7 @@ test( "addClass: flipped bottom", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); elem.position( { my: "left top", @@ -513,7 +513,7 @@ test( "addClass: flipped bottom", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); }); test( "fractions", function() { @@ -523,7 +523,7 @@ test( "fractions", function() { of: "#fractions-parent", collision: "none" }); - same( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" ); + deepEqual( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" ); }); test( "bug #5280: consistent results (avoid fractional values)", function() { @@ -541,7 +541,7 @@ test( "bug #5280: consistent results (avoid fractional values)", function() { of: wrapper, collision: "none" }).offset(); - same( offset1, offset2 ); + deepEqual( offset1, offset2 ); }); }( jQuery ) ); diff --git a/tests/unit/position/position_core_within.js b/tests/unit/position/position_core_within.js index 392e409c5..9dc91238f 100644 --- a/tests/unit/position/position_core_within.js +++ b/tests/unit/position/position_core_within.js @@ -34,7 +34,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "left top, left top" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "left top, left top" ); $( "#elx" ).position({ my: "left top", @@ -43,7 +43,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "left top, left bottom" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "left top, left bottom" ); $( "#elx" ).position({ my: "left", @@ -52,7 +52,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 55, left: addLeft + 50 }, "left, bottom" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 55, left: addLeft + 50 }, "left, bottom" ); $( "#elx" ).position({ my: "left foo", @@ -61,7 +61,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 45, left: addLeft +50 }, "left foo, bar baz" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 45, left: addLeft +50 }, "left foo, bar baz" ); }); test( "multiple elements", function() { @@ -74,10 +74,10 @@ test( "multiple elements", function() { within: $("#within-container") }); - same( result, elements ); + deepEqual( result, elements ); var expected = { top: addTop + 10, left: addLeft + 4 }; elements.each(function() { - same( $( this ).addOffsets(), expected ); + deepEqual( $( this ).addOffsets(), expected ); }); }); @@ -114,7 +114,7 @@ test( "positions", function() { collision: "none", within: $("#within-container") }); - same( el.addOffsets(), definition.result, + deepEqual( el.addOffsets(), definition.result, "Position via " + QUnit.jsDump.parse({ my:definition.my, at:definition.at }) ); }); }); @@ -129,7 +129,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "selector" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "selector" ); $( "#elx" ).position({ my: "left top", @@ -138,7 +138,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "jQuery object" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "jQuery object" ); $( "#elx" ).position({ my: "left top", @@ -147,7 +147,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" ); var event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } ); $( "#elx" ).position({ @@ -157,7 +157,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 300, left: 200 }, "event - left top, left top" ); @@ -170,7 +170,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 600, left: 400 }, "event - left top, right bottom" ); @@ -186,7 +186,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 70, left: addLeft + 50 }, "offsets in at" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 70, left: addLeft + 50 }, "offsets in at" ); $( "#elx" ).position({ my: "left+10 top-10", @@ -195,7 +195,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 50, left: addLeft + 50 }, "offsets in my" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 50, left: addLeft + 50 }, "offsets in my" ); $( "#elx" ).position({ my: "left top", @@ -204,7 +204,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 58, left: addLeft + 50 }, "percentage offsets in at" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 58, left: addLeft + 50 }, "percentage offsets in at" ); $( "#elx" ).position({ my: "left-30% top+50%", @@ -213,7 +213,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 65, left: addLeft + 37 }, "percentage offsets in my" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 65, left: addLeft + 37 }, "percentage offsets in my" ); }); test( "using", function() { @@ -239,15 +239,15 @@ test( "using", function() { using: function( position ) { position.top -= within.offset().top; position.left -= within.offset().left; - same( this, elems[ count ], "correct context for call #" + count ); - same( position, expectedPosition, "correct position for call #" + count ); + deepEqual( this, elems[ count ], "correct context for call #" + count ); + deepEqual( position, expectedPosition, "correct position for call #" + count ); count++; }, within: within }); elems.each(function() { - same( $( this ).addOffsets(), originalPosition, "elements not moved" ); + deepEqual( $( this ).addOffsets(), originalPosition, "elements not moved" ); }); }); @@ -261,7 +261,7 @@ function collisionTest( config, result, msg ) { within: within }, config ) ); - same( elem.addOffsets(), result, msg ); + deepEqual( elem.addOffsets(), result, msg ); } function collisionTest2( config, result, msg ) { @@ -458,7 +458,7 @@ test( "addClass: flipped left", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); elem.position( { my: "right center", @@ -468,7 +468,7 @@ test( "addClass: flipped left", function() { at: "left center" }) - same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); }); test( "addClass: flipped top", function() { @@ -482,7 +482,7 @@ test( "addClass: flipped top", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); elem.position( { my: "left bottom", @@ -492,7 +492,7 @@ test( "addClass: flipped top", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); }); test( "addClass: flipped right", function() { @@ -506,7 +506,7 @@ test( "addClass: flipped right", function() { at: "left center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); elem.position( { my: "left center", @@ -516,7 +516,7 @@ test( "addClass: flipped right", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); }); @@ -530,7 +530,7 @@ test( "addClass: flipped bottom", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); elem.position( { my: "left top", @@ -539,7 +539,7 @@ test( "addClass: flipped bottom", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); }); }( jQuery ) ); diff --git a/tests/unit/position/position_deprecated.js b/tests/unit/position/position_deprecated.js index 3e72c4a4d..9a3164246 100644 --- a/tests/unit/position/position_deprecated.js +++ b/tests/unit/position/position_deprecated.js @@ -8,7 +8,7 @@ test( "offset", function() { offset: "10", collision: "none" }); - same( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" ); + deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" ); $( "#elx" ).position({ my: "left top", @@ -17,7 +17,7 @@ test( "offset", function() { offset: "5 -3", collision: "none" }); - same( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" ); + deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" ); $( "#elx" ).position({ my: "left top", @@ -26,7 +26,7 @@ test( "offset", function() { offset: "5px -3px", collision: "none" }); - same( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" ); + deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" ); }); }( jQuery ) ); diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index a499d858c..a0ea6c48f 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -12,17 +12,17 @@ test("accessibility", function() { expect(7); el = $("#progressbar").progressbar(); - equals(el.attr("role"), "progressbar", "aria role"); - equals(el.attr("aria-valuemin"), 0, "aria-valuemin"); - equals(el.attr("aria-valuemax"), 100, "aria-valuemax"); - equals(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); + equal(el.attr("role"), "progressbar", "aria role"); + equal(el.attr("aria-valuemin"), 0, "aria-valuemin"); + equal(el.attr("aria-valuemax"), 100, "aria-valuemax"); + equal(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); el.progressbar("value", 77); - equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); + equal(el.attr("aria-valuenow"), 77, "aria-valuenow"); el.progressbar("disable"); - equals(el.attr("aria-disabled"), "true", "aria-disabled on"); + equal(el.attr("aria-disabled"), "true", "aria-disabled on"); el.progressbar("enable"); // FAIL: for some reason IE6 and 7 return a boolean false instead of the string - equals(el.attr("aria-disabled"), "false", "aria-disabled off"); + equal(el.attr("aria-disabled"), "false", "aria-disabled off"); }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_events.js b/tests/unit/progressbar/progressbar_events.js index 585c09091..8d7b8868d 100644 --- a/tests/unit/progressbar/progressbar_events.js +++ b/tests/unit/progressbar/progressbar_events.js @@ -10,7 +10,7 @@ test("create", function() { $("#progressbar").progressbar({ value: 5, create: function() { - same(5, $(this).progressbar("value") ); + deepEqual(5, $(this).progressbar("value") ); }, change: function() { ok(false, 'create() has triggered change()'); @@ -22,7 +22,7 @@ test("change", function() { expect(1); $("#progressbar").progressbar({ change: function() { - same( 5, $(this).progressbar("value") ); + deepEqual( 5, $(this).progressbar("value") ); } }).progressbar("value", 5); }); @@ -31,17 +31,17 @@ test( "complete", function() { expect( 3 ); var changes = 0, value; - + $( "#progressbar" ).progressbar({ change: function() { changes++; - same( $( this ).progressbar( "value" ), value, "change at " + value ); + deepEqual( $( this ).progressbar( "value" ), value, "change at " + value ); }, complete: function() { equal( changes, 2, "complete triggered after change" ); } }); - + value = 5; $( "#progressbar" ).progressbar( "value", value ); value = 100; diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index a48fa3d47..966c0c55a 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -21,16 +21,16 @@ test("destroy", function() { var expected = $('
    ').progressbar(), actual = expected.progressbar('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test('value', function() { expect(3); - + var el = $('
    ').progressbar({ value: 20 }); - equals(el.progressbar('value'), 20, 'correct value as getter'); - equals(el.progressbar('value', 30), el, 'chainable as setter'); - equals(el.progressbar('option', 'value'), 30, 'correct value after setter'); + equal(el.progressbar('value'), 20, 'correct value as getter'); + equal(el.progressbar('value', 30), el, 'chainable as setter'); + equal(el.progressbar('option', 'value'), 30, 'correct value after setter'); }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_options.js b/tests/unit/progressbar/progressbar_options.js index 230c939ab..815606ec6 100644 --- a/tests/unit/progressbar/progressbar_options.js +++ b/tests/unit/progressbar/progressbar_options.js @@ -7,7 +7,7 @@ module("progressbar: options"); test("{ value : 0 }, default", function() { $("#progressbar").progressbar(); - same( 0, $("#progressbar").progressbar("value") ); + deepEqual( 0, $("#progressbar").progressbar("value") ); }); // Ticket #7231 - valueDiv should be hidden when value is at 0% @@ -31,21 +31,21 @@ test("{ value : 5 }", function() { $("#progressbar").progressbar({ value: 5 }); - same( 5, $("#progressbar").progressbar("value") ); + deepEqual( 5, $("#progressbar").progressbar("value") ); }); test("{ value : -5 }", function() { $("#progressbar").progressbar({ value: -5 }); - same( 0, $("#progressbar").progressbar("value") ); + deepEqual( 0, $("#progressbar").progressbar("value") ); }); test("{ value : 105 }", function() { $("#progressbar").progressbar({ value: 105 }); - same( 100, $("#progressbar").progressbar("value") ); + deepEqual( 100, $("#progressbar").progressbar("value") ); }); test("{ max : 5, value : 10 }", function() { @@ -53,7 +53,7 @@ test("{ max : 5, value : 10 }", function() { max: 5, value: 10 }); - same( 5, $("#progressbar").progressbar("value") ); + deepEqual( 5, $("#progressbar").progressbar("value") ); }); })(jQuery); diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js index 33a3f723b..aef2ae15c 100644 --- a/tests/unit/resizable/resizable_core.js +++ b/tests/unit/resizable/resizable_core.js @@ -14,7 +14,7 @@ var drag = function(el, dx, dy, complete) { $(el).simulate("mouseover"); return $(el).simulate("drag", { - dx: dx||0, dy: dy||0, speed: 'sync', complete: complete + dx: dx||0, dy: dy||0, speed: 'sync', complete: complete }); }; @@ -47,10 +47,10 @@ test("n", function() { var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 0, -50); - equals( target.height(), 150, "compare height" ); + equal( target.height(), 150, "compare height" ); drag(handle, 0, 50); - equals( target.height(), 100, "compare height" ); + equal( target.height(), 100, "compare height" ); }); test("s", function() { @@ -59,10 +59,10 @@ test("s", function() { var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 0, 50); - equals( target.height(), 150, "compare height" ); + equal( target.height(), 150, "compare height" ); drag(handle, 0, -50); - equals( target.height(), 100, "compare height" ); + equal( target.height(), 100, "compare height" ); }); test("e", function() { @@ -71,10 +71,10 @@ test("e", function() { var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 50); - equals( target.width(), 150, "compare width"); + equal( target.width(), 150, "compare width"); drag(handle, -50); - equals( target.width(), 100, "compare width" ); + equal( target.width(), 100, "compare width" ); }); test("w", function() { @@ -83,10 +83,10 @@ test("w", function() { var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50); - equals( target.width(), 150, "compare width" ); + equal( target.width(), 150, "compare width" ); drag(handle, 50); - equals( target.width(), 100, "compare width" ); + equal( target.width(), 100, "compare width" ); }); test("ne", function() { @@ -95,12 +95,12 @@ test("ne", function() { var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 50, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 50, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("se", function() { @@ -109,12 +109,12 @@ test("se", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 50, 50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, -50, -50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("sw", function() { @@ -123,12 +123,12 @@ test("sw", function() { var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 50, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 50, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("nw", function() { @@ -137,12 +137,12 @@ test("nw", function() { var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); })(jQuery); diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js index 6ac287fe2..03e91d440 100644 --- a/tests/unit/resizable/resizable_methods.js +++ b/tests/unit/resizable/resizable_methods.js @@ -44,20 +44,20 @@ test("destroy", function() { var expected = $('
    ').resizable(), actual = expected.resizable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
    ').resizable(), actual = expected.resizable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); ok(false, "missing test - untested code is broken code."); }); test("disable", function() { var expected = $('
    ').resizable(), actual = expected.resizable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index 389931f92..76cca560a 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -11,12 +11,12 @@ test("aspectRatio: 'preserve' (e)", function() { var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -130); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (w)", function() { @@ -25,12 +25,12 @@ test("aspectRatio: 'preserve' (w)", function() { var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 130); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (n)", function() { @@ -39,12 +39,12 @@ test("aspectRatio: 'preserve' (n)", function() { var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 0, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 0, 80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (s)", function() { @@ -53,12 +53,12 @@ test("aspectRatio: 'preserve' (s)", function() { var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 0, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 0, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (se)", function() { @@ -67,12 +67,12 @@ test("aspectRatio: 'preserve' (se)", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -80, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (sw)", function() { @@ -81,12 +81,12 @@ test("aspectRatio: 'preserve' (sw)", function() { var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, -80, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 80, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (ne)", function() { @@ -95,12 +95,12 @@ test("aspectRatio: 'preserve' (ne)", function() { var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -80, 80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("grid", function() { @@ -109,12 +109,12 @@ test("grid", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] }); drag(handle, 3, 9); - equals( target.width(), 103, "compare width"); - equals( target.height(), 100, "compare height"); + equal( target.width(), 103, "compare width"); + equal( target.height(), 100, "compare height"); drag(handle, 15, 11); - equals( target.width(), 118, "compare width"); - equals( target.height(), 120, "compare height"); + equal( target.width(), 118, "compare width"); + equal( target.height(), 120, "compare height"); }); test("grid (wrapped)", function() { @@ -123,12 +123,12 @@ test("grid (wrapped)", function() { var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] }); drag(handle, 3, 9); - equals( target.width(), 103, "compare width"); - equals( target.height(), 100, "compare height"); + equal( target.width(), 103, "compare width"); + equal( target.height(), 100, "compare height"); drag(handle, 15, 11); - equals( target.width(), 118, "compare width"); - equals( target.height(), 120, "compare height"); + equal( target.width(), 118, "compare width"); + equal( target.height(), 120, "compare height"); }); test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -137,12 +137,12 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, -50, -50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, 70, 70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -151,12 +151,12 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, 50, -50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, -70, 70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -165,12 +165,12 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, -50, 50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, 70, -70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -179,12 +179,12 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, 70, 70); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, -70, -70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); })(jQuery); diff --git a/tests/unit/selectable/selectable_events.js b/tests/unit/selectable/selectable_events.js index 03b65ab88..2623818a7 100644 --- a/tests/unit/selectable/selectable_events.js +++ b/tests/unit/selectable/selectable_events.js @@ -11,7 +11,7 @@ test("start", function() { el.selectable({ start: function(ev, ui) { ok(true, "drag fired start callback"); - equals(this, el[0], "context of callback"); + equal(this, el[0], "context of callback"); } }); el.simulate("drag", 20, 20); @@ -23,7 +23,7 @@ test("stop", function() { el.selectable({ start: function(ev, ui) { ok(true, "drag fired stop callback"); - equals(this, el[0], "context of callback"); + equal(this, el[0], "context of callback"); } }); el.simulate("drag", 20, 20); diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js index 06b75f9fc..32dfe00ed 100644 --- a/tests/unit/selectable/selectable_methods.js +++ b/tests/unit/selectable/selectable_methods.js @@ -44,7 +44,7 @@ test("destroy", function() { var expected = $('
    ').selectable(), actual = expected.selectable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -57,15 +57,15 @@ test("enable", function() { start: function() { fired = true; } }); el.simulate("drag", 20, 20); - equals(fired, false, "start fired"); + equal(fired, false, "start fired"); el.selectable("enable"); el.simulate("drag", 20, 20); - equals(fired, true, "start fired"); + equal(fired, true, "start fired"); el.selectable("destroy"); - + var expected = $('
    ').selectable(), actual = expected.selectable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -78,16 +78,16 @@ test("disable", function() { start: function() { fired = true; } }); el.simulate("drag", 20, 20); - equals(fired, true, "start fired"); + equal(fired, true, "start fired"); el.selectable("disable"); fired = false; el.simulate("drag", 20, 20); - equals(fired, false, "start fired"); + equal(fired, false, "start fired"); el.selectable("destroy"); - + var expected = $('
    ').selectable(), actual = expected.selectable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/selectable/selectable_options.js b/tests/unit/selectable/selectable_options.js index 36b7b5b0d..2bc44e6e0 100644 --- a/tests/unit/selectable/selectable_options.js +++ b/tests/unit/selectable/selectable_options.js @@ -14,7 +14,7 @@ test("autoRefresh", function() { el = $("#selectable1").selectable({ autoRefresh: false, selected: selected }); sel.hide(); drag(1000, 1000); - equals(actual, sel.length); + equal(actual, sel.length); el.selectable("destroy"); actual = 0; @@ -22,10 +22,10 @@ test("autoRefresh", function() { el = $("#selectable1").selectable({ autoRefresh: true, selected: selected }); sel.hide(); drag(1000, 1000); - equals(actual, 0); + equal(actual, 0); sel.show(); drag(1000, 1000); - equals(actual, sel.length); + equal(actual, sel.length); el.selectable("destroy"); sel.show(); }); @@ -39,7 +39,7 @@ test("filter", function() { el = $("#selectable1").selectable({ filter: '.special', selected: selected }); drag(1000, 1000); ok(sel.length != 1, "this test assumes more than 1 selectee"); - equals(actual, 1); + equal(actual, 1); el.selectable("destroy"); }); diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js index 38d4f4669..e5f21ee1b 100644 --- a/tests/unit/slider/slider_core.js +++ b/tests/unit/slider/slider_core.js @@ -28,9 +28,9 @@ test("keydown HOME on handle sets value to min", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider('destroy'); + el.slider('destroy'); el = $('
    '); options = { @@ -44,7 +44,7 @@ test("keydown HOME on handle sets value to min", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); el.slider('destroy'); }); @@ -62,9 +62,9 @@ test("keydown END on handle sets value to max", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.END }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider('destroy'); + el.slider('destroy'); el = $('
    '); options = { @@ -78,7 +78,7 @@ test("keydown END on handle sets value to max", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.END }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); el.slider('destroy'); }); @@ -97,10 +97,10 @@ test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than m el.slider("value", 70); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); - equals(el.slider("value"), 90); + equal(el.slider("value"), 90); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); - equals(el.slider("value"), 100); + equal(el.slider("value"), 100); el.slider("destroy"); }); @@ -120,10 +120,10 @@ test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than mi el.slider("value", 30); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); - equals(el.slider("value"), 10); + equal(el.slider("value"), 10); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); - equals(el.slider("value"), 0); + equal(el.slider("value"), 0); el.slider("destroy"); }); @@ -142,12 +142,12 @@ test("keydown UP on handle increases value by step, not greater than max", funct el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); el = $('
    '); options = { @@ -161,12 +161,12 @@ test("keydown UP on handle increases value by step, not greater than max", funct el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown RIGHT on handle increases value by step, not greater than max", function() { @@ -182,12 +182,12 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); el = $('
    '); options = { @@ -201,12 +201,12 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown DOWN on handle decreases value by step, not less than min", function() { @@ -222,12 +222,12 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); el = $('
    '); options = { @@ -241,12 +241,12 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown LEFT on handle decreases value by step, not less than min", function() { @@ -262,12 +262,12 @@ test("keydown LEFT on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); el = $('
    '); options = { @@ -281,12 +281,12 @@ test("keydown LEFT on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); }); })(jQuery); diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js index 0b7b250f2..9e39d2a3e 100644 --- a/tests/unit/slider/slider_events.js +++ b/tests/unit/slider/slider_events.js @@ -2,7 +2,7 @@ * slider_events.js */ (function($) { - + module( "slider: events" ); //Specs from http://wiki.jqueryui.com/Slider#specs @@ -11,21 +11,21 @@ module( "slider: events" ); // or value method/option" test( "mouse based interaction", function() { expect(4); - + var el = $( "
    " ) .appendTo( "body" ) .slider({ start: function(event, ui) { - equals( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); + equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); }, slide: function(event, ui) { - equals( event.originalEvent.type, "mousemove", "slider triggered by mousemove" ); + equal( event.originalEvent.type, "mousemove", "slider triggered by mousemove" ); }, stop: function(event, ui) { - equals( event.originalEvent.type, "mouseup", "stop triggered by mouseup" ); + equal( event.originalEvent.type, "mouseup", "stop triggered by mouseup" ); }, change: function(event, ui) { - equals( event.originalEvent.type, "mouseup", "change triggered by mouseup" ); + equal( event.originalEvent.type, "mouseup", "change triggered by mouseup" ); } }); @@ -35,22 +35,22 @@ test( "mouse based interaction", function() { }); test( "keyboard based interaction", function() { expect(3); - + // Test keyup at end of handle slide (keyboard) var el = $( "
    " ) .appendTo( "body" ) .slider({ start: function(event, ui) { - equals( event.originalEvent.type, "keydown", "start triggered by keydown" ); + equal( event.originalEvent.type, "keydown", "start triggered by keydown" ); }, slide: function(event, ui) { ok( false, "Slider never triggered by keys" ); }, stop: function(event, ui) { - equals( event.originalEvent.type, "keyup", "stop triggered by keyup" ); + equal( event.originalEvent.type, "keyup", "stop triggered by keyup" ); }, change: function(event, ui) { - equals( event.originalEvent.type, "keyup", "change triggered by keyup" ); + equal( event.originalEvent.type, "keyup", "change triggered by keyup" ); } }); @@ -62,7 +62,7 @@ test( "keyboard based interaction", function() { }); test( "programmatic event triggers", function() { expect(6); - + // Test value method var el = $( "
    " ) .slider({ diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 66624e8a8..b46222002 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -38,13 +38,13 @@ test("destroy", function() { var expected = $('
    ').slider(), actual = expected.slider('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
    ').slider(), actual = expected.slider('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); var el = $('
    ').slider({ disabled: true }); ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call'); @@ -57,7 +57,7 @@ test("enable", function() { test("disable", function() { var expected = $('
    ').slider(), actual = expected.slider('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); var el = $('
    ').slider({ disabled: false }); ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call'); @@ -73,9 +73,9 @@ test("value", function() { range: this, value: 5 }); - equals(el.slider('value'), 5, 'range: ' + this + ' slider method get'); - equals(el.slider('value', 10), el, 'value method is chainable'); - equals(el.slider('value'), 10, 'range: ' + this + ' slider method set'); + equal(el.slider('value'), 5, 'range: ' + this + ' slider method get'); + equal(el.slider('value', 10), el, 'value method is chainable'); + equal(el.slider('value'), 10, 'range: ' + this + ' slider method set'); el.remove(); }); var el = $('
    ').slider({ @@ -83,16 +83,16 @@ test("value", function() { }); // min with value option vs value method el.slider('option', 'value', -2); - equals(el.slider('option', 'value'), -2, 'value option does not respect min'); - equals(el.slider('value'), -1, 'value method get respects min'); - equals(el.slider('value', -2), el, 'value method is chainable'); - equals(el.slider('option', 'value'), -1, 'value method set respects min'); + equal(el.slider('option', 'value'), -2, 'value option does not respect min'); + equal(el.slider('value'), -1, 'value method get respects min'); + equal(el.slider('value', -2), el, 'value method is chainable'); + equal(el.slider('option', 'value'), -1, 'value method set respects min'); // max with value option vs value method el.slider('option', 'value', 2); - equals(el.slider('option', 'value'), 2, 'value option does not respect max'); - equals(el.slider('value'), 1, 'value method get respects max'); - equals(el.slider('value', 2), el, 'value method is chainable'); - equals(el.slider('option', 'value'), 1, 'value method set respects max'); + equal(el.slider('option', 'value'), 2, 'value option does not respect max'); + equal(el.slider('value'), 1, 'value method get respects max'); + equal(el.slider('value', 2), el, 'value method is chainable'); + equal(el.slider('option', 'value'), 1, 'value method set respects max'); }); //test("values", function() { diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js index 040589bd6..7d9899284 100644 --- a/tests/unit/slider/slider_options.js +++ b/tests/unit/slider/slider_options.js @@ -13,7 +13,7 @@ module("slider: options"); test("max", function() { el = $('
    '); - + options = { max: 37, min: 6, @@ -31,7 +31,7 @@ test("max", function() { test("min", function() { el = $('
    '); - + options = { max: 37, min: 6, @@ -62,7 +62,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "horizontal"); ok(el.is('.ui-slider-horizontal'), "horizontal slider has class .ui-slider-horizontal"); ok(!el.is('.ui-slider-vertical'), "horizontal slider does not have class .ui-slider-vertical"); - equals(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); + equal(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); el.slider('destroy'); @@ -78,7 +78,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "vertical"); ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical"); ok(!el.is('.ui-slider-horizontal'), "vertical slider does not have class .ui-slider-horizontal"); - equals(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); + equal(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); el.slider('destroy'); @@ -98,19 +98,19 @@ test("step", function() { step: 10, max: 100 }); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("value", 1); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("value", 9); - equals( el.slider("value"), 10 ); + equal( el.slider("value"), 10 ); el.slider("value", 11); - equals( el.slider("value"), 10 ); + equal( el.slider("value"), 10 ); el.slider("value", 19); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el = $('
    ').slider({ min: 0, @@ -121,16 +121,16 @@ el = $('
    ').slider({ el.slider("value", 0); el.slider("option", "value", 1); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("option", "value", 9); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("option", "value", 11); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el.slider("option", "value", 19); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el.slider('destroy'); }); diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index c4b5cdc08..2446d2755 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -17,7 +17,7 @@ var drag = function(handle, dx, dy) { var sort = function(handle, dx, dy, index, msg) { drag(handle, dx, dy); - equals($(handle).parent().children().index(handle), index, msg); + equal($(handle).parent().children().index(handle), index, msg); } module("sortable: methods"); @@ -59,7 +59,7 @@ test("destroy", function() { var expected = $('
    ').sortable(), actual = expected.sortable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -69,18 +69,18 @@ test("enable", function() { sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })'); el.sortable("enable"); - equals(el.sortable("option", "disabled"), false, "disabled option getter"); + equal(el.sortable("option", "disabled"), false, "disabled option getter"); el.sortable("destroy"); el.sortable({ disabled: true }); el.sortable("option", "disabled", false); - equals(el.sortable("option", "disabled"), false, "disabled option setter"); + equal(el.sortable("option", "disabled"), false, "disabled option setter"); sort($("li", el)[0], 0, 40, 2, '.sortable("option", "disabled", false)'); - + var expected = $('
    ').sortable(), actual = expected.sortable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -96,13 +96,13 @@ test("disable", function() { el.sortable({ disabled: false }); sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); el.sortable("option", "disabled", true); - equals(el.sortable("option", "disabled"), true, "disabled option setter"); + equal(el.sortable("option", "disabled"), true, "disabled option setter"); ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction"); sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)'); - + var expected = $('
    ').sortable(), actual = expected.sortable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js index 3edc8c04c..6ee503a58 100644 --- a/tests/unit/sortable/sortable_tickets.js +++ b/tests/unit/sortable/sortable_tickets.js @@ -17,7 +17,7 @@ var drag = function(handle, dx, dy) { var sort = function(handle, dx, dy, index, msg) { drag(handle, dx, dy); - equals($(handle).parent().children().index(handle), index, msg); + equal($(handle).parent().children().index(handle), index, msg); } module("sortable: tickets"); @@ -32,7 +32,7 @@ test("#3019: Stop fires too early", function() { }); sort($("li", el)[0], 0, 40, 2, 'Dragging the sortable'); - equals(helper, null, "helper should be false"); + equal(helper, null, "helper should be false"); }); diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js index a9fd6c889..9c82218e1 100644 --- a/tests/unit/spinner/spinner_methods.js +++ b/tests/unit/spinner/spinner_methods.js @@ -22,34 +22,34 @@ test( "disable", function() { ok( element.is( ":disabled"), "after: input has disabled attribute" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.UP ); - equals( 2, element.val(), "keyboard - value does not change on key UP" ); + equal( 2, element.val(), "keyboard - value does not change on key UP" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN ); - equals( 2, element.val(), "keyboard - value does not change on key DOWN" ); + equal( 2, element.val(), "keyboard - value does not change on key DOWN" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP ); - equals( 2, element.val(), "keyboard - value does not change on key PGUP" ); + equal( 2, element.val(), "keyboard - value does not change on key PGUP" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN ); - equals( 2, element.val(), "keyboard - value does not change on key PGDN" ); + equal( 2, element.val(), "keyboard - value does not change on key PGDN" ); wrapper.find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); - equals( 2, element.val(), "mouse - value does not change on clicking up button" ); + equal( 2, element.val(), "mouse - value does not change on clicking up button" ); wrapper.find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); - equals( 2, element.val(), "mouse - value does not change on clicking down button" ); + equal( 2, element.val(), "mouse - value does not change on clicking down button" ); element.spinner( "stepUp", 6 ); - equals( 8, element.val(), "script - stepUp 6 steps changes value"); + equal( 8, element.val(), "script - stepUp 6 steps changes value"); element.spinner( "stepDown" ); - equals( 7, element.val(), "script - stepDown 1 step changes value" ); + equal( 7, element.val(), "script - stepDown 1 step changes value" ); element.spinner( "pageUp" ); - equals( 17, element.val(), "script - pageUp 1 page changes value" ); + equal( 17, element.val(), "script - pageUp 1 page changes value" ); element.spinner( "pageDown" ); - equals( 7, element.val(), "script - pageDown 1 page changes value" ); + equal( 7, element.val(), "script - pageDown 1 page changes value" ); }); test( "enable", function() { @@ -66,7 +66,7 @@ test( "enable", function() { ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.UP ); - equals( 2, element.val(), "keyboard - value changes on key UP" ); + equal( 2, element.val(), "keyboard - value changes on key UP" ); }); test( "pageDown", function() { @@ -77,16 +77,16 @@ test( "pageDown", function() { }); element.spinner( "pageDown" ); - equals( element.val(), -32, "pageDown 1 page" ); + equal( element.val(), -32, "pageDown 1 page" ); element.spinner( "pageDown", 3 ); - equals( element.val(), -92, "pageDown 3 pages" ); + equal( element.val(), -92, "pageDown 3 pages" ); element.spinner( "pageDown" ); - equals( element.val(), -100, "value close to min and pageDown 1 page" ); + equal( element.val(), -100, "value close to min and pageDown 1 page" ); element.spinner( "pageDown", 10 ); - equals( element.val(), -100, "value at min and pageDown 10 pages" ); + equal( element.val(), -100, "value at min and pageDown 10 pages" ); }); test( "pageUp", function() { @@ -97,16 +97,16 @@ test( "pageUp", function() { }); element.spinner( "pageUp" ); - equals( element.val(), 32, "pageUp 1 page" ); + equal( element.val(), 32, "pageUp 1 page" ); element.spinner( "pageUp", 3 ); - equals( element.val(), 92, "pageUp 3 pages" ); + equal( element.val(), 92, "pageUp 3 pages" ); element.spinner( "pageUp" ); - equals( element.val(), 100, "value close to max and pageUp 1 page" ); + equal( element.val(), 100, "value close to max and pageUp 1 page" ); element.spinner( "pageUp", 10 ); - equals( element.val(), 100, "value at max and pageUp 10 pages" ); + equal( element.val(), 100, "value at max and pageUp 10 pages" ); }); test( "stepDown", function() { @@ -117,16 +117,16 @@ test( "stepDown", function() { }); element.spinner( "stepDown" ); - equals( element.val(), "-1", "stepDown 1 step" ); + equal( element.val(), "-1", "stepDown 1 step" ); element.spinner( "stepDown", 5 ); - equals( element.val(), "-11", "stepDown 5 steps" ); + equal( element.val(), "-11", "stepDown 5 steps" ); element.spinner( "stepDown", 4 ); - equals( element.val(), "-15", "close to min and stepDown 4 steps" ); + equal( element.val(), "-15", "close to min and stepDown 4 steps" ); element.spinner( "stepDown" ); - equals( element.val(), "-15", "at min and stepDown 1 step" ); + equal( element.val(), "-15", "at min and stepDown 1 step" ); }); test( "stepUp", function() { @@ -137,16 +137,16 @@ test( "stepUp", function() { }); element.spinner( "stepUp" ); - equals( element.val(), 2, "stepUp 1 step" ); + equal( element.val(), 2, "stepUp 1 step" ); element.spinner( "stepUp", 5 ); - equals( element.val(), 12, "stepUp 5 steps" ); + equal( element.val(), 12, "stepUp 5 steps" ); element.spinner( "stepUp", 4 ); - equals( element.val(), 16, "close to min and stepUp 4 steps" ); + equal( element.val(), 16, "close to min and stepUp 4 steps" ); element.spinner( "stepUp" ); - equals( element.val(), 16, "at max and stepUp 1 step" ); + equal( element.val(), 16, "at max and stepUp 1 step" ); }); test( "value", function() { @@ -156,9 +156,9 @@ test( "value", function() { }); element.spinner( "value", 10 ); - equals( element.val(), 9, "change value via value method" ); + equal( element.val(), 9, "change value via value method" ); - equals( element.spinner( "value" ), 9, "get value via value method" ); + equal( element.spinner( "value" ), 9, "get value via value method" ); }); })( jQuery ); diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js index 0be59bd07..cbad3f870 100644 --- a/tests/unit/spinner/spinner_options.js +++ b/tests/unit/spinner/spinner_options.js @@ -141,13 +141,13 @@ test( "currency, change", function() { test( "max", function() { expect( 3 ); var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 }); - equals( element.val(), 1000, "value not constrained on init" ); + equal( element.val(), 1000, "value not constrained on init" ); element.spinner( "value", 1000 ); - equals( element.val(), 100, "max constrained in value method" ); + equal( element.val(), 100, "max constrained in value method" ); element.val( 1000 ).blur(); - equals( element.val(), 1000, "max not constrained if manual entry" ); + equal( element.val(), 1000, "max not constrained if manual entry" ); }); test( "max, string", function() { @@ -159,23 +159,23 @@ test( "max, string", function() { numberFormat: "C", culture: "en" }); - equals( element.val(), "$1,000.00", "value not constrained on init" ); - equals( element.spinner( "option", "max" ), 100, "option converted to number" ); + equal( element.val(), "$1,000.00", "value not constrained on init" ); + equal( element.spinner( "option", "max" ), 100, "option converted to number" ); element.spinner( "value", 1000 ); - equals( element.val(), "$100.00", "max constrained in value method" ); + equal( element.val(), "$100.00", "max constrained in value method" ); }); test( "min", function() { expect( 3 ); var element = $( "#spin" ).val( -1000 ).spinner({ min: -100 }); - equals( element.val(), -1000, "value not constrained on init" ); + equal( element.val(), -1000, "value not constrained on init" ); element.spinner( "value", -1000 ); - equals( element.val(), -100, "min constrained in value method" ); + equal( element.val(), -100, "min constrained in value method" ); element.val( -1000 ).blur(); - equals( element.val(), -1000, "min not constrained if manual entry" ); + equal( element.val(), -1000, "min not constrained if manual entry" ); }); test( "min, string", function() { @@ -187,11 +187,11 @@ test( "min, string", function() { numberFormat: "C", culture: "en" }); - equals( element.val(), "($1,000.00)", "value not constrained on init" ); - equals( element.spinner( "option", "min" ), -100, "option converted to number" ); + equal( element.val(), "($1,000.00)", "value not constrained on init" ); + equal( element.spinner( "option", "min" ), -100, "option converted to number" ); element.spinner( "value", -1000 ); - equals( element.val(), "($100.00)", "min constrained in value method") + equal( element.val(), "($100.00)", "min constrained in value method") }); test( "step, 2", function() { @@ -199,14 +199,14 @@ test( "step, 2", function() { var element = $( "#spin" ).val( 0 ).spinner({ step: 2 }); element.spinner( "stepUp" ); - equals( element.val(), "2", "stepUp" ); + equal( element.val(), "2", "stepUp" ); element.spinner( "value", "10.5" ); - equals( element.val(), "10", "value reset to 10" ); + equal( element.val(), "10", "value reset to 10" ); element.val( "4.5" ); element.spinner( "stepUp" ); - equals( element.val(), "6", "stepUp" ); + equal( element.val(), "6", "stepUp" ); }); test( "step, 0.7", function() { @@ -216,7 +216,7 @@ test( "step, 0.7", function() { }); element.spinner( "stepUp" ); - equals( element.val(), "0.7", "stepUp" ); + equal( element.val(), "0.7", "stepUp" ); }); test( "step, string", function() { @@ -227,10 +227,10 @@ test( "step, string", function() { culture: "en" }); - equals( element.spinner( "option", "step" ), 0.7, "option converted to number" ); + equal( element.spinner( "option", "step" ), 0.7, "option converted to number" ); element.spinner( "stepUp" ); - equals( element.val(), "$0.70", "stepUp" ); + equal( element.val(), "$0.70", "stepUp" ); }); })( jQuery ); diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index f2a672b2e..fc494e013 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -49,7 +49,7 @@ } return -1; // mixed state - invalid }).get(); - same( actual, expected ); + deepEqual( actual, expected ); } function tabs_disabled( tabs, state ) { @@ -83,8 +83,8 @@ } return -1; // mixed state - invalid }).get(); - same( tabs.tabs( "option", "disabled" ), state ); - same( actual, expected ); + deepEqual( tabs.tabs( "option", "disabled" ), state ); + deepEqual( actual, expected ); } diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index e7c1ee576..263032921 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -31,15 +31,15 @@ test( "nested list", function() { expect( 1 ); var element = $( "#tabs6" ).tabs(); - equals( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" ); + equal( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" ); }); test( "disconnected from DOM", function() { expect( 2 ); var element = $( "#tabs1" ).remove().tabs(); - equals( element.find( ".ui-tabs-nav" ).length, 1, "should initialize nav" ); - equals( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" ); + equal( element.find( ".ui-tabs-nav" ).length, 1, "should initialize nav" ); + equal( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" ); }); test( "aria-controls", function() { @@ -87,7 +87,7 @@ test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", funct } }); - equals( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); + equal( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); tabs_state( element, 1 ); }); diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 92d9be81c..410aebc40 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -48,7 +48,7 @@ } return -1; // mixed state - invalid }).get(); - same( actual, expected ); + deepEqual( actual, expected ); } function tabs_disabled( tabs, state ) { @@ -82,8 +82,8 @@ } return -1; // mixed state - invalid }).get(); - same( tabs.tabs( "option", "disabled" ), state ); - same( actual, expected ); + deepEqual( tabs.tabs( "option", "disabled" ), state ); + deepEqual( actual, expected ); } diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index d0d13fa84..80bc4a326 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -35,7 +35,7 @@ asyncTest( "ajaxOptions", function() { } }); element.one( "tabsload", function( event, ui ) { - equals( $( ui.panel ).html(), "test" ); + equal( $( ui.panel ).html(), "test" ); start(); }); element.tabs( "option", "active", 2 ); @@ -56,7 +56,7 @@ asyncTest( "cache", function() { setTimeout(function() { element.tabs( "option", "active", 0 ); tabs_state( element, 1, 0, 0, 0, 0 ); - + element.one( "tabsshow", function( event, ui ) { tabs_state( element, 0, 0, 1, 0, 0 ); }); @@ -105,10 +105,10 @@ test( "tabTemplate + panelTemplate", function() { element.tabs( "add", "#new", "New" ); var tab = element.find( ".ui-tabs-nav li" ).last(), anchor = tab.find( "a" ); - equals( tab.text(), "New", "label" ); + equal( tab.text(), "New", "label" ); ok( tab.hasClass( "customTab" ), "tab custom class" ); - equals( anchor.attr( "href" ), "http://example.com/#new", "href" ); - equals( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( anchor.attr( "href" ), "http://example.com/#new", "href" ); + equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" ); }); @@ -124,24 +124,24 @@ test( "cookie", function() { } element.tabs({ cookie: cookieObj }); - equals( cookie(), 0, "initial cookie value" ); + equal( cookie(), 0, "initial cookie value" ); element.tabs( "destroy" ); element.tabs({ active: 1, cookie: cookieObj }); - equals( cookie(), 1, "initial cookie value, from active property" ); + equal( cookie(), 1, "initial cookie value, from active property" ); element.tabs( "option", "active", 2 ); - equals( cookie(), 2, "cookie value updated after activating" ); + equal( cookie(), 2, "cookie value updated after activating" ); element.tabs( "destroy" ); $.cookie( cookieName, 1 ); element.tabs({ cookie: cookieObj }); - equals( cookie(), 1, "initial cookie value, from existing cookie" ); + equal( cookie(), 1, "initial cookie value, from existing cookie" ); element.tabs( "destroy" ); element.tabs({ cookie: cookieObj, collapsible: true }); element.tabs( "option", "active", false ); - equals( cookie(), -1, "cookie value for all tabs unselected" ); + equal( cookie(), -1, "cookie value for all tabs unselected" ); element.tabs( "destroy" ); ok( $.cookie( cookieName ) === null, "erase cookie after destroy" ); @@ -153,12 +153,12 @@ asyncTest( "spinner", function() { var element = $( "#tabs2" ).tabs(); element.one( "tabsbeforeload", function( event, ui ) { - equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" ); + equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" ); }); element.one( "tabsload", function( event, ui ) { // wait until after the load finishes before checking for the spinner to be removed setTimeout(function() { - equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" ); + equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" ); start(); }, 1 ); }); @@ -169,13 +169,13 @@ test( "selected", function() { expect( 19 ); var element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "selected" ), 0, "should be 0 by default" ); + equal( element.tabs( "option", "selected" ), 0, "should be 0 by default" ); tabs_state( element, 1, 0, 0 ); element.tabs( "destroy" ); location.hash = "#fragment-3"; element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" ); + equal( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" ); tabs_state( element, 0, 0, 1 ); element.tabs( "destroy" ); @@ -200,19 +200,19 @@ test( "selected", function() { element.tabs( "destroy" ); element.tabs({ selected: 2 }); - equals( element.tabs( "option", "selected" ), 2 ); + equal( element.tabs( "option", "selected" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "selected", 0 ); - equals( element.tabs( "option", "selected" ), 0 ); + equal( element.tabs( "option", "selected" ), 0 ); tabs_state( element, 1, 0, 0 ); element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); - equals( element.tabs( "option", "selected" ), 1 ); + equal( element.tabs( "option", "selected" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "selected", 10 ); - equals( element.tabs( "option", "selected" ), 1 ); + equal( element.tabs( "option", "selected" ), 1 ); tabs_state( element, 0, 1, 0 ); location.hash = "#"; @@ -235,7 +235,7 @@ asyncTest( "load", function() { ok( !( "originalEvent" in event ), "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 1, 0, 0 ); tabsload1(); }); @@ -251,7 +251,7 @@ asyncTest( "load", function() { ok( !( "originalEvent" in event ), "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 1, 0 ); tabsload2(); }); @@ -265,10 +265,10 @@ asyncTest( "load", function() { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 0, 1 ); start(); }); @@ -282,9 +282,9 @@ test( "enable", function() { var element = $( "#tabs1" ).tabs({ disabled: [ 0, 1 ], enable: function( event, ui ) { - equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); - equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); - equals( ui.index, 1, "ui.index" ); + equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equal( ui.index, 1, "ui.index" ); } }); element.tabs( "enable", 1 ); @@ -297,9 +297,9 @@ test( "disable", function() { var element = $( "#tabs1" ).tabs({ disable: function( event, ui ) { - equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); - equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); - equals( ui.index, 1, "ui.index" ); + equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equal( ui.index, 1, "ui.index" ); } }); element.tabs( "disable", 1 ); @@ -331,7 +331,7 @@ test( "show", function() { // switching tabs element.one( "tabsshow", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); @@ -371,7 +371,7 @@ test( "select", function() { // switching tabs element.one( "tabsselect", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); @@ -406,9 +406,9 @@ test( "add", function() { tabs_state( element, 1, 0, 0, 0 ); var tab = element.find( ".ui-tabs-nav li" ).last(), anchor = tab.find( "a" ); - equals( tab.text(), "New", "label" ); - equals( anchor.attr( "href" ), "#new", "href" ); - equals( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( tab.text(), "New", "label" ); + equal( anchor.attr( "href" ), "#new", "href" ); + equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); ok( tab.hasClass( "ui-state-hover" ), "hovered" ); @@ -425,8 +425,8 @@ test( "add", function() { tabs_state( element, 0, 0, 0, 0, 1 ); tab = element.find( ".ui-tabs-nav li" ).eq( 1 ); anchor = tab.find( "a" ); - equals( tab.text(), "New Remote", "label" ); - equals( anchor.attr( "href" ), "data/test.html", "href" ); + equal( tab.text(), "New Remote", "label" ); + equal( anchor.attr( "href" ), "data/test.html", "href" ); ok( /^ui-tabs-\d+$/.test( anchor.attr( "aria-controls" ) ), "aria controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); @@ -436,7 +436,7 @@ test( "add", function() { // add to empty tab set element = $( "
      " ).tabs(); - equals( element.tabs( "option", "active" ), false, "active: false on init" ); + equal( element.tabs( "option", "active" ), false, "active: false on init" ); element.one( "tabsadd", function( event, ui ) { equal( ui.index, 0, "ui.index" ); equal( $( ui.tab ).text(), "First", "ui.tab" ); @@ -444,16 +444,16 @@ test( "add", function() { }); element.tabs( "add", "#first", "First" ); tabs_state( element, 1 ); - equals( element.tabs( "option", "active" ), 0, "active: 0 after add" ); + equal( element.tabs( "option", "active" ), 0, "active: 0 after add" ); }); test( "#5069 - ui.tabs.add creates two tab panels when using a full URL", function() { expect( 2 ); var element = $( "#tabs2" ).tabs(); - equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); + equal( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); element.tabs( "add", "/new", "New" ); - equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); + equal( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); }); test( "remove", function() { @@ -469,10 +469,10 @@ test( "remove", function() { }); element.tabs( "remove", 1 ); tabs_state( element, 0, 1 ); - equals( element.tabs( "option", "active" ), 1 ); - equals( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0, + equal( element.tabs( "option", "active" ), 1 ); + equal( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0, "remove correct list item" ); - equals( element.find( "#fragment-2" ).length, 0, "remove correct panel" ); + equal( element.find( "#fragment-2" ).length, 0, "remove correct panel" ); element.one( "tabsremove", function( event, ui ) { equal( ui.index, -1, "ui.index" ); @@ -481,7 +481,7 @@ test( "remove", function() { }); element.tabs( "remove", 1 ); tabs_state( element, 1 ); - equals( element.tabs( "option", "active"), 0 ); + equal( element.tabs( "option", "active"), 0 ); element.one( "tabsremove", function( event, ui ) { equal( ui.index, -1, "ui.index" ); @@ -489,7 +489,7 @@ test( "remove", function() { equal( ui.panel.id, "fragment-1", "ui.panel" ); }); element.tabs( "remove", 0 ); - equals( element.tabs( "option", "active" ), false ); + equal( element.tabs( "option", "active" ), false ); }); test( "select", function() { @@ -499,49 +499,49 @@ test( "select", function() { tabs_state( element, 1, 0, 0 ); element.tabs( "select", 1 ); tabs_state( element, 0, 1, 0 ); - equals( element.tabs( "option", "active" ), 1, "active" ); - equals( element.tabs( "option", "selected" ), 1, "selected" ); + equal( element.tabs( "option", "active" ), 1, "active" ); + equal( element.tabs( "option", "selected" ), 1, "selected" ); element.tabs( "destroy" ); element.tabs({ collapsible: true }); tabs_state( element, 1, 0, 0 ); element.tabs( "select", 0 ); tabs_state( element, 0, 0, 0 ); - equals( element.tabs( "option", "active" ), false, "active" ); - equals( element.tabs( "option", "selected" ), -1, "selected" ); + equal( element.tabs( "option", "active" ), false, "active" ); + equal( element.tabs( "option", "selected" ), -1, "selected" ); element.tabs( "destroy" ); element.tabs({ collapsible: true }); element.tabs( "select", -1 ); tabs_state( element, 0, 0, 0 ); - equals( element.tabs( "option", "active" ), false, "active" ); - equals( element.tabs( "option", "selected" ), -1, "selected" ); + equal( element.tabs( "option", "active" ), false, "active" ); + equal( element.tabs( "option", "selected" ), -1, "selected" ); element.tabs( "destroy" ); element.tabs(); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", 0 ); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", -1 ); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", "#fragment-2" ); tabs_state( element, 0, 1, 0 ); - equals( element.tabs( "option", "active" ), 1, "active" ); - equals( element.tabs( "option", "selected" ), 1, "selected" ); + equal( element.tabs( "option", "active" ), 1, "active" ); + equal( element.tabs( "option", "selected" ), 1, "selected" ); }); test( "length", function() { expect( 2 ); - equals( $( "#tabs1" ).tabs().tabs( "length" ), 3, "basic tabs" ); - equals( $( "#tabs2" ).tabs().tabs( "length" ), 5, "ajax tabs with missing panels" ); + equal( $( "#tabs1" ).tabs().tabs( "length" ), 3, "basic tabs" ); + equal( $( "#tabs2" ).tabs().tabs( "length" ), 5, "ajax tabs with missing panels" ); }); test( "url", function() { @@ -551,9 +551,9 @@ test( "url", function() { tab = element.find( "a" ).eq( 3 ); element.tabs( "url", 3, "data/test2.html" ); - equals( tab.attr( "href" ), "data/test2.html", "href was updated" ); + equal( tab.attr( "href" ), "data/test2.html", "href was updated" ); element.one( "tabsbeforeload", function( event, ui ) { - equals( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" ); + equal( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" ); event.preventDefault(); }); element.tabs( "option", "active", 3 ); @@ -565,7 +565,7 @@ asyncTest( "abort", function() { var element = $( "#tabs2" ).tabs(); element.one( "tabsbeforeload", function( event, ui ) { ui.jqXHR.error(function( jqXHR, status ) { - equals( status, "abort", "aborted" ); + equal( status, "abort", "aborted" ); start(); }); }); diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index 333578907..4f9269b62 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -11,9 +11,9 @@ test( "create", function() { element.tabs({ create: function( event, ui ) { - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" ); } }); @@ -22,9 +22,9 @@ test( "create", function() { element.tabs({ active: 2, create: function( event, ui ) { - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" ); } }); @@ -34,8 +34,8 @@ test( "create", function() { active: false, collapsible: true, create: function( event, ui ) { - equals( ui.tab.size(), 0, "tab size" ); - equals( ui.panel.size(), 0, "panel size" ); + equal( ui.tab.size(), 0, "tab size" ); + equal( ui.panel.size(), 0, "panel size" ); } }); element.tabs( "destroy" ); @@ -54,11 +54,11 @@ test( "beforeActivate", function() { // from collapsed element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldPanel size" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldPanel size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 0, 0, 0 ); }); @@ -67,14 +67,14 @@ test( "beforeActivate", function() { // switching tabs element.one( "tabsbeforeactivate", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); @@ -84,12 +84,12 @@ test( "beforeActivate", function() { // collapsing element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); - equals( ui.newTab.size(), 0, "newTab size" ); - equals( ui.newPanel.size(), 0, "newPanel size" ); + equal( ui.newTab.size(), 0, "newTab size" ); + equal( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 1, 0 ); }); element.tabs( "option", "active", false ); @@ -98,11 +98,11 @@ test( "beforeActivate", function() { // prevent activation element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldTab" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldTab" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); event.preventDefault(); tabs_state( element, 0, 0, 0 ); @@ -124,11 +124,11 @@ test( "activate", function() { // from collapsed element.one( "tabsactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldPanel size" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldPanel size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); @@ -137,14 +137,14 @@ test( "activate", function() { // switching tabs element.one( "tabsactivate", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 0, 1, 0 ); }); @@ -154,12 +154,12 @@ test( "activate", function() { // collapsing element.one( "tabsactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); - equals( ui.newTab.size(), 0, "newTab size" ); - equals( ui.newPanel.size(), 0, "newPanel size" ); + equal( ui.newTab.size(), 0, "newTab size" ); + equal( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 0, 0 ); }); element.tabs( "option", "active", false ); @@ -191,17 +191,17 @@ test( "beforeLoad", function() { ok( !( "originalEvent" in event ), "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.html(), "", "panel html" ); + equal( ui.panel.html(), "", "panel html" ); event.preventDefault(); tabs_state( element, 0, 0, 1, 0, 0 ); }); element.tabs({ active: 2 }); tabs_state( element, 0, 0, 1, 0, 0 ); - equals( panel.html(), "", "panel html after" ); + equal( panel.html(), "", "panel html after" ); element.tabs( "destroy" ); // .option() @@ -213,18 +213,18 @@ test( "beforeLoad", function() { ok( !( "originalEvent" in event ), "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.html(), "", "panel html" ); + equal( ui.panel.html(), "", "panel html" ); event.preventDefault(); tabs_state( element, 1, 0, 0, 0, 0 ); }); element.tabs(); element.tabs( "option", "active", 2 ); tabs_state( element, 0, 0, 1, 0, 0 ); - equals( panel.html(), "", "panel html after" ); + equal( panel.html(), "", "panel html after" ); // click, change panel content element.one( "tabsbeforeload", function( event, ui ) { @@ -232,12 +232,12 @@ test( "beforeLoad", function() { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); ui.panel.html( "

      testing

      " ); event.preventDefault(); @@ -246,7 +246,7 @@ test( "beforeLoad", function() { element.find( ".ui-tabs-nav a" ).eq( 3 ).click(); tabs_state( element, 0, 0, 0, 1, 0 ); // .toLowerCase() is needed to convert

      to

      in old IEs - equals( panel.html().toLowerCase(), "

      testing

      ", "panel html after" ); + equal( panel.html().toLowerCase(), "

      testing

      ", "panel html after" ); }); if ( $.uiBackCompat === false ) { @@ -261,13 +261,13 @@ if ( $.uiBackCompat === false ) { tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 1, 0, 0 ); tabsload1(); }); @@ -281,11 +281,11 @@ if ( $.uiBackCompat === false ) { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 1, 0 ); tabsload2(); }); @@ -299,12 +299,12 @@ if ( $.uiBackCompat === false ) { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 0, 1 ); start(); }); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index b62f7bb3a..fee87db96 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -94,14 +94,14 @@ test( "refresh", function() { element.tabs( "refresh" ); tabs_state( element, 1, 0, 0, 0 ); tabs_disabled( element, [ 1 ] ); - equals( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1, + equal( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1, "panel added for remote tab" ); // remove all tabs element.find( ".ui-tabs-nav li, .ui-tabs-panel" ).remove(); element.tabs( "refresh" ); tabs_state( element ); - equals( element.tabs( "option", "active" ), false, "no active tab" ); + equal( element.tabs( "option", "active" ), false, "no active tab" ); // add tabs element.find( ".ui-tabs-nav" ) @@ -136,7 +136,7 @@ test( "refresh", function() { element.tabs( "refresh" ); tabs_state( element, 0, 1 ); tabs_disabled( element, [ 0 ] ); - + // remove first tab, previously active tab (now first) should stay active element.find( ".ui-tabs-nav li" ).eq( 0 ).remove(); element.find( ".ui-tabs-panel" ).eq( 0 ).remove(); @@ -158,9 +158,9 @@ asyncTest( "load", function() { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 1, 0, 0, 0, 0 ); }); @@ -172,13 +172,13 @@ asyncTest( "load", function() { var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( uiTab.size(), 1, "tab size" ); + equal( uiTab.size(), 1, "tab size" ); strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); - equals( uiPanel.size(), 1, "panel size" ); + equal( uiPanel.size(), 1, "panel size" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); - equals( uiPanel.find( "p" ).length, 1, "panel html" ); + equal( uiPanel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 1, 0, 0, 0, 0 ); setTimeout( tabsload1, 100 ); }); @@ -206,9 +206,9 @@ asyncTest( "load", function() { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 0, 0, 0, 1, 0 ); }); @@ -220,11 +220,11 @@ asyncTest( "load", function() { var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( uiTab.size(), 1, "tab size" ); + equal( uiTab.size(), 1, "tab size" ); strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); - equals( uiPanel.size(), 1, "panel size" ); + equal( uiPanel.size(), 1, "panel size" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 0, 0, 0, 1, 0 ); start(); diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index 8d61c47ef..e1ebf5efa 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -6,13 +6,13 @@ test( "{ active: default }", function() { expect( 4 ); var element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "active" ), 0, "should be 0 by default" ); + equal( element.tabs( "option", "active" ), 0, "should be 0 by default" ); tabs_state( element, 1, 0, 0 ); element.tabs( "destroy" ); location.hash = "#fragment-3"; element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "active" ), 2, "should be 2 based on URL" ); + equal( element.tabs( "option", "active" ), 2, "should be 2 based on URL" ); tabs_state( element, 0, 0, 1 ); element.tabs( "destroy" ); location.hash = "#"; @@ -47,19 +47,19 @@ test( "{ active: Number }", function() { var element = $( "#tabs1" ).tabs({ active: 2 }); - equals( element.tabs( "option", "active" ), 2 ); + equal( element.tabs( "option", "active" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "active", 0 ); - equals( element.tabs( "option", "active" ), 0 ); + equal( element.tabs( "option", "active" ), 0 ); tabs_state( element, 1, 0, 0 ); element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", 10 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); }); @@ -68,19 +68,19 @@ if ( $.uiBackCompat === false ) { var element = $( "#tabs1" ).tabs({ active: -1 }); - equals( element.tabs( "option", "active" ), 2 ); + equal( element.tabs( "option", "active" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "active", -2 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", -10 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", -3 ); - equals( element.tabs( "option", "active" ), 0 ); + equal( element.tabs( "option", "active" ), 0 ); tabs_state( element, 1, 0, 0 ); }); } @@ -90,7 +90,7 @@ test( "active - mismatched tab/panel order", function() { location.hash = "#tabs7-2"; var element = $( "#tabs7" ).tabs(); - equals( element.tabs( "option", "active" ), 1, "should be 1 based on URL" ); + equal( element.tabs( "option", "active" ), 1, "should be 1 based on URL" ); tabs_state( element, 0, 1 ); element.tabs( "option", "active", 0 ); tabs_state( element, 1, 0 ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index c8afcbe79..d37e27f7b 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -10,7 +10,7 @@ function testWidgetDefaults( widget, defaults ) { ok( $.isFunction( pluginDefaults[ key ] ), key ); return; } - same( pluginDefaults[ key ], val, key ); + deepEqual( pluginDefaults[ key ], val, key ); }); }); @@ -67,13 +67,13 @@ window.commonWidgetTests = function( widget, settings ) { /* * Experimental assertion for comparing DOM objects. - * + * * Serializes an element and some attributes and it's children if any, otherwise the text. * Then compares the result using deepEqual. */ window.domEqual = function( selector, modifier, message ) { var attributes = ["class", "role", "id", "tabIndex", "aria-activedescendant"]; - + function extract(value) { if (!value || !value.length) { QUnit.push( false, actual, expected, "domEqual failed, can't extract " + selector + ", message was: " + message ); @@ -97,7 +97,7 @@ window.domEqual = function( selector, modifier, message ) { } var expected = extract($(selector)); modifier($(selector)); - + var actual = extract($(selector)); QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); } diff --git a/tests/unit/tooltip/tooltip_events.js b/tests/unit/tooltip/tooltip_events.js index bf60c3cdc..b1ce92fb2 100644 --- a/tests/unit/tooltip/tooltip_events.js +++ b/tests/unit/tooltip/tooltip_events.js @@ -27,12 +27,12 @@ test( "mouse events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "mouseover" ); + deepEqual( event.originalEvent.type, "mouseover" ); }); element.trigger( "mouseover" ); element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "mouseleave" ); + deepEqual( event.originalEvent.type, "mouseleave" ); }); element.trigger( "mouseleave" ); }); @@ -42,12 +42,12 @@ test( "focus events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "focusin" ); + deepEqual( event.originalEvent.type, "focusin" ); }); element.trigger( "focusin" ); element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "focusout" ); + deepEqual( event.originalEvent.type, "focusout" ); }); element.trigger( "focusout" ); }); @@ -57,7 +57,7 @@ asyncTest( "mixed events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "focusin" ); + deepEqual( event.originalEvent.type, "focusin" ); }); element.simulate( "focus" ); @@ -74,7 +74,7 @@ asyncTest( "mixed events", function() { // blurring is async in IE element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "focusout" ); + deepEqual( event.originalEvent.type, "focusout" ); start(); }); element.simulate( "blur" ); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 74fd35d84..3e8256c50 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -59,8 +59,8 @@ TODO currently tooltip doesn't override widget can't return anything useful if no element is kept around and there's no useful reference test("widget", function() { var tooltip = $("#tooltipped1").tooltip(); - same(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); - same(tooltip.tooltip("widget").end()[0], tooltip[0]); + deepEqual(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); + deepEqual(tooltip.tooltip("widget").end()[0], tooltip[0]); }); */ diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 04bb4c6a4..42529e087 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -4,7 +4,7 @@ module( "tooltip: options" ); test( "content: default", function() { var element = $( "#tooltipped1" ).tooltip().tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" ); }); test( "content: return string", function() { @@ -13,7 +13,7 @@ test( "content: return string", function() { return "customstring"; } }).tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); }); test( "content: return jQuery", function() { @@ -22,7 +22,7 @@ test( "content: return jQuery", function() { return $( "
      " ).html( "customstring" ); } }).tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); }); asyncTest( "content: sync + async callback", function() { @@ -30,11 +30,11 @@ asyncTest( "content: sync + async callback", function() { var element = $( "#tooltipped1" ).tooltip({ content: function( response ) { setTimeout(function() { - same( $( "#" + element.attr("aria-describedby") ).text(), "loading..." ); + deepEqual( $( "#" + element.attr("aria-describedby") ).text(), "loading..." ); response( "customstring2" ); setTimeout(function() { - same( $( "#" + element.attr("aria-describedby") ).text(), "customstring2" ); + deepEqual( $( "#" + element.attr("aria-describedby") ).text(), "customstring2" ); start(); }, 13 ); }, 13 ); @@ -52,12 +52,12 @@ test( "items", function() { var event = $.Event( "mouseenter" ); event.target = $( "#fixture-span" )[ 0 ]; element.tooltip( "open", event ); - same( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" ); + deepEqual( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" ); // make sure default [title] doesn't get used event.target = $( "#tooltipped1" )[ 0 ]; element.tooltip( "open", event ); - same( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined ); + deepEqual( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined ); element.tooltip( "destroy" ); }); diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 86fa658aa..c451c4cf6 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -14,12 +14,12 @@ test( "widget creation", function() { $.widget( "ui.testWidget", myPrototype ); ok( $.isFunction( $.ui.testWidget ), "constructor was created" ); - equals( "object", typeof $.ui.testWidget.prototype, "prototype was created" ); - equals( $.ui.testWidget.prototype._create, myPrototype._create, + equal( "object", typeof $.ui.testWidget.prototype, "prototype was created" ); + equal( $.ui.testWidget.prototype._create, myPrototype._create, "create function is copied over" ); - equals( $.ui.testWidget.prototype.creationTest, myPrototype.creationTest, + equal( $.ui.testWidget.prototype.creationTest, myPrototype.creationTest, "random function is copied over" ); - equals( $.ui.testWidget.prototype.option, $.Widget.prototype.option, + equal( $.ui.testWidget.prototype.option, $.Widget.prototype.option, "option method copied over from base widget" ); }); @@ -32,36 +32,36 @@ test( "element normalization", function() { // workaround for core ticket #8381 this.element.appendTo( "#qunit-fixture" ); ok( this.element.is( "div" ), "generated div" ); - same( this.element.data( "testWidget" ), this, "intance stored in .data()" ); + deepEqual( this.element.data( "testWidget" ), this, "intance stored in .data()" ); }; $.ui.testWidget(); $.ui.testWidget.prototype.defaultElement = ""; $.ui.testWidget.prototype._create = function() { ok( this.element.is( "span[data-test=pass]" ), "generated span with properties" ); - same( this.element.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget(); elem = $( "" ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from element" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from element" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem[ 0 ] ); elem = $( "
      " ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from jQuery object" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from jQuery object" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem ); elem = $( "
      " ) .appendTo( "#qunit-fixture" ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from selector" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from selector" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, "#element-normalization-selector" ); @@ -85,9 +85,9 @@ test( "jQuery usage", function() { }, methodWithParams: function( param1, param2 ) { ok( true, "method called via .pluginName(methodName)" ); - equals( param1, "value1", + equal( param1, "value1", "parameter passed via .pluginName(methodName, param)" ); - equals( param2, "value2", + equal( param2, "value2", "multiple parameters passed via .pluginName(methodName, param, param)" ); return this; @@ -113,16 +113,16 @@ test( "jQuery usage", function() { shouldCreate = false; var instance = elem.data( "testWidget" ); - equals( typeof instance, "object", "instance stored in .data(pluginName)" ); - equals( instance.element[0], elem[0], "element stored on widget" ); + equal( typeof instance, "object", "instance stored in .data(pluginName)" ); + equal( instance.element[0], elem[0], "element stored on widget" ); var ret = elem.testWidget( "methodWithParams", "value1", "value2" ); - equals( ret, elem, "jQuery object returned from method call" ); + equal( ret, elem, "jQuery object returned from method call" ); ret = elem.testWidget( "getterSetterMethod" ); - equals( ret, 5, "getter/setter can act as getter" ); + equal( ret, 5, "getter/setter can act as getter" ); ret = elem.testWidget( "getterSetterMethod", 30 ); - equals( ret, elem, "getter/setter method can be chainable" ); - equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); + equal( ret, elem, "getter/setter method can be chainable" ); + equal( instance.getterSetterVal, 30, "getter/setter can act as setter" ); ret = elem.testWidget( "jQueryObject" ); equal( ret[ 0 ], document.body, "returned jQuery object" ); equal( ret.end(), elem, "stack preserved" ); @@ -140,8 +140,8 @@ test( "direct usage", function() { }, methodWithParams: function( param1, param2 ) { ok( true, "method called dirctly" ); - equals( param1, "value1", "parameter passed via direct call" ); - equals( param2, "value2", "multiple parameters passed via direct call" ); + equal( param1, "value1", "parameter passed via direct call" ); + equal( param2, "value2", "multiple parameters passed via direct call" ); return this; }, @@ -160,17 +160,17 @@ test( "direct usage", function() { var instance = new $.ui.testWidget( {}, elem ); shouldCreate = false; - equals( $( elem ).data( "testWidget" ), instance, + equal( $( elem ).data( "testWidget" ), instance, "instance stored in .data(pluginName)" ); - equals( instance.element[ 0 ], elem, "element stored on widget" ); + equal( instance.element[ 0 ], elem, "element stored on widget" ); var ret = instance.methodWithParams( "value1", "value2" ); - equals( ret, instance, "plugin returned from method call" ); + equal( ret, instance, "plugin returned from method call" ); ret = instance.getterSetterMethod(); - equals( ret, 5, "getter/setter can act as getter" ); + equal( ret, 5, "getter/setter can act as getter" ); instance.getterSetterMethod( 30 ); - equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); + equal( instance.getterSetterVal, 30, "getter/setter can act as setter" ); }); test( "error handling", function() { @@ -201,7 +201,7 @@ test( "merge multiple option arguments", function() { expect( 1 ); $.widget( "ui.testWidget", { _create: function() { - same( this.options, { + deepEqual( this.options, { create: null, disabled: false, option1: "value1", @@ -249,7 +249,7 @@ test( "._getCreateOptions()", function() { }; }, _create: function() { - same( this.options, { + deepEqual( this.options, { create: null, disabled: false, option1: "override1", @@ -294,15 +294,15 @@ test( "re-init", function() { actions = []; div.testWidget({ foo: "bar" }); - same( actions, [ "create", "init" ], "correct methods called on init" ); + deepEqual( actions, [ "create", "init" ], "correct methods called on init" ); actions = []; div.testWidget(); - same( actions, [ "init" ], "correct methods call on re-init" ); + deepEqual( actions, [ "init" ], "correct methods call on re-init" ); actions = []; div.testWidget({ foo: "bar" }); - same( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" ); + deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" ); }); test( "inheritance - options", function() { @@ -326,18 +326,18 @@ test( "inheritance - options", function() { } }); - same( $.ui.testWidgetBase.prototype.options.obj, { + deepEqual( $.ui.testWidgetBase.prototype.options.obj, { key1: "foo", key2: "bar" }, "base class option object not overridden"); - same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ], + deepEqual( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ], "base class option array not overridden"); - same( $.ui.testWidgetExtension.prototype.options.obj, { + deepEqual( $.ui.testWidgetExtension.prototype.options.obj, { key1: "baz", key2: "bar" }, "extension class option object extends base"); - same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ], + deepEqual( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ], "extension class option array overwrites base"); delete $.ui.testWidgetBase; @@ -349,28 +349,28 @@ test( "._super()", function() { var instance; $.widget( "ui.testWidget", { method: function( a, b ) { - same( this, instance, "this is correct in testWidget" ); - same( a, 5, "parameter passed to testWidget" ); - same( b, 20, "second parameter passed to testWidget" ); + deepEqual( this, instance, "this is correct in testWidget" ); + deepEqual( a, 5, "parameter passed to testWidget" ); + deepEqual( b, 20, "second parameter passed to testWidget" ); return a + b; } }); $.widget( "ui.testWidget2", $.ui.testWidget, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget2" ); - same( a, 5, "parameter passed to testWidget2" ); - same( b, 10, "parameter passed to testWidget2" ); + deepEqual( this, instance, "this is correct in testWidget2" ); + deepEqual( a, 5, "parameter passed to testWidget2" ); + deepEqual( b, 10, "parameter passed to testWidget2" ); return this._super( a, b*2 ); } }); $.widget( "ui.testWidget3", $.ui.testWidget2, { method: function( a ) { - same( this, instance, "this is correct in testWidget3" ); - same( a, 5, "parameter passed to testWidget3" ); + deepEqual( this, instance, "this is correct in testWidget3" ); + deepEqual( a, 5, "parameter passed to testWidget3" ); var ret = this._super( a, a*2 ); - same( ret, 25, "super returned value" ); + deepEqual( ret, 25, "super returned value" ); } }); @@ -385,29 +385,29 @@ test( "._superApply()", function() { var instance; $.widget( "ui.testWidget", { method: function( a, b ) { - same( this, instance, "this is correct in testWidget" ); - same( a, 5, "parameter passed to testWidget" ); - same( b, 10, "second parameter passed to testWidget" ); + deepEqual( this, instance, "this is correct in testWidget" ); + deepEqual( a, 5, "parameter passed to testWidget" ); + deepEqual( b, 10, "second parameter passed to testWidget" ); return a + b; } }); $.widget( "ui.testWidget2", $.ui.testWidget, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget2" ); - same( a, 5, "parameter passed to testWidget2" ); - same( b, 10, "second parameter passed to testWidget2" ); + deepEqual( this, instance, "this is correct in testWidget2" ); + deepEqual( a, 5, "parameter passed to testWidget2" ); + deepEqual( b, 10, "second parameter passed to testWidget2" ); return this._superApply( arguments ); } }); $.widget( "ui.testWidget3", $.ui.testWidget2, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget3" ); - same( a, 5, "parameter passed to testWidget3" ); - same( b, 10, "second parameter passed to testWidget3" ); + deepEqual( this, instance, "this is correct in testWidget3" ); + deepEqual( a, 5, "parameter passed to testWidget3" ); + deepEqual( b, 10, "second parameter passed to testWidget3" ); var ret = this._superApply( arguments ); - same( ret, 15, "super returned value" ); + deepEqual( ret, 15, "super returned value" ); } }); @@ -428,14 +428,14 @@ test( ".option() - getter", function() { qux: [ "quux", "quuux" ] }); - same( div.testWidget( "option", "x" ), null, "non-existent option" ); - same( div.testWidget( "option", "foo"), "bar", "single option - string" ); - same( div.testWidget( "option", "baz"), 5, "single option - number" ); - same( div.testWidget( "option", "qux"), [ "quux", "quuux" ], + deepEqual( div.testWidget( "option", "x" ), null, "non-existent option" ); + deepEqual( div.testWidget( "option", "foo"), "bar", "single option - string" ); + deepEqual( div.testWidget( "option", "baz"), 5, "single option - number" ); + deepEqual( div.testWidget( "option", "qux"), [ "quux", "quuux" ], "single option - array" ); var options = div.testWidget( "option" ); - same( options, { + deepEqual( options, { create: null, disabled: false, foo: "bar", @@ -443,7 +443,7 @@ test( ".option() - getter", function() { qux: [ "quux", "quuux" ] }, "full options hash returned" ); options.foo = "notbar"; - same( div.testWidget( "option", "foo"), "bar", + deepEqual( div.testWidget( "option", "foo"), "bar", "modifying returned options hash does not modify plugin instance" ); }); @@ -477,14 +477,14 @@ test( ".option() - delegate to ._setOptions()", function() { calls = []; div.testWidget( "option", "foo", "bar" ); - same( calls, [{ foo: "bar" }], "_setOptions called for single option" ); + deepEqual( calls, [{ foo: "bar" }], "_setOptions called for single option" ); calls = []; div.testWidget( "option", { bar: "qux", quux: "quuux" }); - same( calls, [{ bar: "qux", quux: "quuux" }], + deepEqual( calls, [{ bar: "qux", quux: "quuux" }], "_setOptions called with multiple options" ); }); @@ -503,7 +503,7 @@ test( ".option() - delegate to ._setOption()", function() { calls = []; div.testWidget( "option", "foo", "bar" ); - same( calls, [{ key: "foo", val: "bar" }], + deepEqual( calls, [{ key: "foo", val: "bar" }], "_setOption called for single option" ); calls = []; @@ -511,7 +511,7 @@ test( ".option() - delegate to ._setOption()", function() { bar: "qux", quux: "quuux" }); - same( calls, [ + deepEqual( calls, [ { key: "bar", val: "qux" }, { key: "quux", val: "quuux" } ], "_setOption called with multiple options" ); @@ -523,8 +523,8 @@ test( ".option() - deep option setter", function() { function deepOption( from, to, msg ) { div.data( "testWidget" ).options.foo = from; $.ui.testWidget.prototype._setOption = function( key, value ) { - same( key, "foo", msg + ": key" ); - same( value, to, msg + ": value" ); + deepEqual( key, "foo", msg + ": key" ); + deepEqual( value, to, msg + ": value" ); }; } @@ -546,8 +546,8 @@ test( ".enable()", function() { $.widget( "ui.testWidget", { _create: function() {}, _setOption: function( key, val ) { - same( key, "disabled", "_setOption called with disabled option" ); - same( val, false, "disabled set to false" ); + deepEqual( key, "disabled", "_setOption called with disabled option" ); + deepEqual( val, false, "disabled set to false" ); } }); $( "
      " ).testWidget().testWidget( "enable" ); @@ -558,8 +558,8 @@ test( ".disable()", function() { $.widget( "ui.testWidget", { _create: function() {}, _setOption: function( key, val ) { - same( key, "disabled", "_setOption called with disabled option" ); - same( val, true, "disabled set to true" ); + deepEqual( key, "disabled", "_setOption called with disabled option" ); + deepEqual( val, true, "disabled set to true" ); } }); $( "
      " ).testWidget().testWidget( "disable" ); @@ -570,7 +570,7 @@ test( ".widget() - base", function() { _create: function() {} }); var div = $( "
      " ).testWidget(); - same( div[0], div.testWidget( "widget" )[0]); + deepEqual( div[0], div.testWidget( "widget" )[0]); }); test( ".widget() - overriden", function() { @@ -581,7 +581,7 @@ test( ".widget() - overriden", function() { return wrapper; } }); - same( wrapper[0], $( "
      " ).testWidget().testWidget( "widget" )[0] ); + deepEqual( wrapper[0], $( "
      " ).testWidget().testWidget( "widget" )[0] ); }); test( "._bind() to element (default)", function() { @@ -596,14 +596,14 @@ test( "._bind() to element (default)", function() { }); }, keyup: function( event ) { - equals( that, this ); - equals( that.element[0], event.currentTarget ); - equals( "keyup", event.type ); + equal( that, this ); + equal( that.element[0], event.currentTarget ); + equal( "keyup", event.type ); }, keydown: function( event ) { - equals( that, this ); - equals( that.element[0], event.currentTarget ); - equals( "keydown", event.type ); + equal( that, this ); + equal( that.element[0], event.currentTarget ); + equal( "keydown", event.type ); } }); var widget = $( "
      " ) @@ -636,14 +636,14 @@ test( "._bind() to descendent", function() { }); }, keyup: function( event ) { - equals( that, this ); - equals( that.element.find( "strong" )[0], event.currentTarget ); - equals( "keyup", event.type ); + equal( that, this ); + equal( that.element.find( "strong" )[0], event.currentTarget ); + equal( "keyup", event.type ); }, keydown: function(event) { - equals( that, this ); - equals( that.element.find( "strong" )[0], event.currentTarget ); - equals( "keydown", event.type ); + equal( that, this ); + equal( that.element.find( "strong" )[0], event.currentTarget ); + equal( "keydown", event.type ); } }); // trigger events on both widget and descendent to ensure that only descendent receives them @@ -794,19 +794,19 @@ test( "._trigger() - no event, no ui", function() { $( "#widget" ).testWidget({ foo: function( event, ui ) { - same( event.type, "testwidgetfoo", "correct event type in callback" ); - same( ui, {}, "empty ui hash passed" ); + deepEqual( event.type, "testwidgetfoo", "correct event type in callback" ); + deepEqual( ui, {}, "empty ui hash passed" ); handlers.push( "callback" ); } }); $( document ).add( "#widget-wrapper" ).add( "#widget" ) .bind( "testwidgetfoo", function( event, ui ) { - same( ui, {}, "empty ui hash passed" ); + deepEqual( ui, {}, "empty ui hash passed" ); handlers.push( this ); }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true, "_trigger returns true when event is not cancelled" ); - same( handlers, [ + deepEqual( handlers, [ $( "#widget" )[ 0 ], $( "#widget-wrapper" )[ 0 ], document, @@ -832,7 +832,7 @@ test( "._trigger() - cancelled event", function() { ok( true, "event was triggered" ); return false; }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, "_trigger returns false when event is cancelled" ); }); @@ -846,7 +846,7 @@ test( "._trigger() - cancelled callback", function() { return false; } }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, "_trigger returns false when callback returns false" ); }); @@ -865,7 +865,7 @@ test( "._trigger() - provide event and ui", function() { } }; this._trigger( "foo", originalEvent, ui ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 10, @@ -876,7 +876,7 @@ test( "._trigger() - provide event and ui", function() { }); $( "#widget" ).bind( "testwidgetfoo", function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, @@ -887,7 +887,7 @@ test( "._trigger() - provide event and ui", function() { }); $( "#widget-wrapper" ).bind( "testwidgetfoo", function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 5, @@ -899,7 +899,7 @@ test( "._trigger() - provide event and ui", function() { $( "#widget" ).testWidget({ foo: function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 10, @@ -933,27 +933,27 @@ test( "._trigger() - array as ui", function() { } }); $( "#widget" ).bind( "testwidgetfoo", function( event, ui, extra ) { - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, quux: 20 } }, "event: ui hash passed" ); - same( extra, { + deepEqual( extra, { bar: 5 }, "event: extra argument passed" ); }); $( "#widget" ).testWidget({ foo: function( event, ui, extra ) { - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, quux: 20 } }, "callback: ui hash passed" ); - same( extra, { + deepEqual( extra, { bar: 5 }, "callback: extra argument passed" ); } @@ -973,12 +973,12 @@ test( "._trigger() - instance as element", function() { var instance = $.ui.testWidget({ foo: function( event, ui ) { equal( event.type, "testwidgetfoo", "event object passed to callback" ); - same( ui, { foo: "bar" }, "ui object passed to callback" ); + deepEqual( ui, { foo: "bar" }, "ui object passed to callback" ); } }); $( instance ).bind( "testwidgetfoo", function( event, ui ) { equal( event.type, "testwidgetfoo", "event object passed to event handler" ); - same( ui, { foo: "bar" }, "ui object passed to event handler" ); + deepEqual( ui, { foo: "bar" }, "ui object passed to event handler" ); }); instance.testEvent(); }); -- 2.39.5