aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2012-10-23 09:36:42 -0500
committerCorey Frang <gnarf@gnarf.net>2012-10-23 09:37:46 -0500
commite1230997aa14dae6f35326c8ba20bfe2428507c2 (patch)
treef00984f5fbbf12f175c0994c497513a2d8e8ee26
parent7af1ec727bcca8367e804cea77b9dd238b1c0d69 (diff)
downloadjquery-ui-e1230997aa14dae6f35326c8ba20bfe2428507c2.tar.gz
jquery-ui-e1230997aa14dae6f35326c8ba20bfe2428507c2.zip
Build: Enable "unused" option in jshint - Remove unused variables from codebase. - Closes gh-788
Squashed commit of the following: commit 7f19f92c646f180bc067bb24123175251a64a9d6 Author: Mike Sherov <mike.sherov@gmail.com> Date: Tue Oct 23 10:34:28 2012 -0400 put back in fake args for signatures that we want to keep commit 257505a9e69da0c53e3a989dab87a13112045a29 Author: Mike Sherov <mike.sherov@gmail.com> Date: Tue Oct 23 08:10:20 2012 -0400 changes per @scott_gonzalez commit 12725480cb58e70865e5aa6e735009b6b035c8f3 Author: Mike Sherov <mike.sherov@gmail.com> Date: Mon Oct 22 22:54:05 2012 -0400 clean up unused vars in ui directory commit 563595e7aee5d4a5c096b2d1de655abdf920aacd Author: Mike Sherov <mike.sherov@gmail.com> Date: Mon Oct 22 22:37:42 2012 -0400 clean up unused vars in grunt and tests
-rw-r--r--.jshintrc3
-rw-r--r--build/release/release.js2
-rw-r--r--build/tasks/build.js2
-rw-r--r--tests/.jshintrc12
-rw-r--r--tests/unit/autocomplete/autocomplete_core.js3
-rw-r--r--tests/unit/autocomplete/autocomplete_events.js6
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js2
-rw-r--r--tests/unit/button/button_events.js2
-rw-r--r--tests/unit/datepicker/datepicker_core.js18
-rw-r--r--tests/unit/datepicker/datepicker_defaults.js4
-rw-r--r--tests/unit/datepicker/datepicker_events.js6
-rw-r--r--tests/unit/datepicker/datepicker_methods.js20
-rw-r--r--tests/unit/datepicker/datepicker_options.js24
-rw-r--r--tests/unit/datepicker/datepicker_tickets.js2
-rw-r--r--tests/unit/dialog/dialog_core.js48
-rw-r--r--tests/unit/dialog/dialog_events.js6
-rw-r--r--tests/unit/dialog/dialog_methods.js2
-rw-r--r--tests/unit/dialog/dialog_options.js30
-rw-r--r--tests/unit/dialog/dialog_tickets.js8
-rw-r--r--tests/unit/draggable/draggable_core.js5
-rw-r--r--tests/unit/draggable/draggable_options.js44
-rw-r--r--tests/unit/droppable/droppable_core.js12
-rw-r--r--tests/unit/droppable/droppable_events.js4
-rw-r--r--tests/unit/droppable/droppable_methods.js16
-rw-r--r--tests/unit/effects/effects_core.js14
-rw-r--r--tests/unit/menu/menu_events.js30
-rw-r--r--tests/unit/menu/menu_methods.js2
-rw-r--r--tests/unit/menu/menu_options.js4
-rw-r--r--tests/unit/resizable/resizable_core.js36
-rw-r--r--tests/unit/resizable/resizable_events.js4
-rw-r--r--tests/unit/resizable/resizable_methods.js3
-rw-r--r--tests/unit/resizable/resizable_options.js52
-rw-r--r--tests/unit/selectable/selectable_core.js2
-rw-r--r--tests/unit/selectable/selectable_events.js4
-rw-r--r--tests/unit/selectable/selectable_methods.js2
-rw-r--r--tests/unit/selectable/selectable_options.js8
-rw-r--r--tests/unit/slider/slider_events.js24
-rw-r--r--tests/unit/slider/slider_methods.js4
-rw-r--r--tests/unit/sortable/sortable_core.js4
-rw-r--r--tests/unit/sortable/sortable_options.js4
-rw-r--r--tests/unit/sortable/sortable_tickets.js6
-rw-r--r--tests/unit/spinner/spinner_options.js6
-rw-r--r--tests/unit/tabs/tabs_core.js5
-rw-r--r--tests/unit/tabs/tabs_deprecated.js16
-rw-r--r--tests/unit/testsuite.js4
-rw-r--r--tests/unit/tooltip/tooltip_options.js2
-rw-r--r--tests/unit/widget/widget_core.js8
-rw-r--r--ui/.jshintrc1
-rw-r--r--ui/jquery.ui.accordion.js2
-rw-r--r--ui/jquery.ui.autocomplete.js4
-rw-r--r--ui/jquery.ui.dialog.js28
-rw-r--r--ui/jquery.ui.effect.js11
-rw-r--r--ui/jquery.ui.slider.js4
-rw-r--r--ui/jquery.ui.tabs.js12
-rw-r--r--ui/jquery.ui.tooltip.js4
-rw-r--r--ui/jquery.ui.widget.js2
56 files changed, 282 insertions, 311 deletions
diff --git a/.jshintrc b/.jshintrc
index e22109220..d6966c51d 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -7,5 +7,6 @@
"node": true,
"onevar": true,
"trailing": true,
- "undef": true
+ "undef": true,
+ "unused": true
}
diff --git a/build/release/release.js b/build/release/release.js
index ae705a90f..2227bf0e6 100644
--- a/build/release/release.js
+++ b/build/release/release.js
@@ -425,7 +425,7 @@ function abort( msg ) {
function walk( methods ) {
var method = methods.shift();
- function next( error ) {
+ function next() {
if ( methods.length ) {
walk( methods );
}
diff --git a/build/tasks/build.js b/build/tasks/build.js
index b59c728d3..18e427a56 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -146,7 +146,7 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
opts: {
cwd: 'dist'
}
- }, function( err, result ) {
+ }, function( err ) {
if ( err ) {
grunt.log.error( err );
done();
diff --git a/tests/.jshintrc b/tests/.jshintrc
index 20094d436..c0f0f8d53 100644
--- a/tests/.jshintrc
+++ b/tests/.jshintrc
@@ -11,8 +11,8 @@
"onevar": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
- "addMonths",
"asyncTest",
"container",
"deepEqual",
@@ -29,8 +29,6 @@
"Globalize",
"heightAfter",
"init",
- "isNotOpen",
- "isOpen",
"modal",
"module",
"moved",
@@ -38,15 +36,7 @@
"offsetAfter",
"offsetBefore",
"ok",
- "PROP_NAME",
"QUnit",
- "restoreScroll",
- "shouldBeDroppable",
- "shouldmove",
- "shouldNotBeDroppable",
- "shouldnotmove",
- "shouldnotresize",
- "shouldresize",
"start",
"strictEqual",
"stop",
diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js
index f0ad36a57..f2062cacd 100644
--- a/tests/unit/autocomplete/autocomplete_core.js
+++ b/tests/unit/autocomplete/autocomplete_core.js
@@ -109,8 +109,7 @@ test( "allow form submit on enter when menu is not active", function() {
function arrowsMoveFocus( id, isKeyUp ) {
expect( 1 );
- var didMove = false,
- element = $( id ).autocomplete({
+ var element = $( id ).autocomplete({
source: [ "a" ],
delay: 0,
minLength: 0
diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js
index 082263a35..fb1cf73a6 100644
--- a/tests/unit/autocomplete/autocomplete_events.js
+++ b/tests/unit/autocomplete/autocomplete_events.js
@@ -39,7 +39,7 @@ $.each([
], "response ui.content" );
ui.content.splice( 0, 1 );
},
- open: function( event ) {
+ open: function() {
ok( menu.is( ":visible" ), "menu open on open" );
},
focus: function( event, ui ) {
@@ -127,7 +127,7 @@ asyncTest( "cancel focus", function() {
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- focus: function( event, ui ) {
+ focus: function() {
$( this ).val( customVal );
return false;
}
@@ -146,7 +146,7 @@ asyncTest( "cancel select", function() {
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- select: function( event, ui ) {
+ select: function() {
$( this ).val( customVal );
return false;
}
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index 1ab40f36c..8331c53d5 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -33,7 +33,7 @@ function autoFocusTest( afValue, focusedLength ) {
autoFocus: afValue,
delay: 0,
source: data,
- open: function( event, ui ) {
+ open: function() {
equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length,
focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" );
start();
diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js
index a2154021d..40d2a1a96 100644
--- a/tests/unit/button/button_events.js
+++ b/tests/unit/button/button_events.js
@@ -1,7 +1,7 @@
/*
* button_events.js
*/
-(function($) {
+(function() {
module("button: events");
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index e17b239e5..4abdfd106 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -12,31 +12,19 @@ function equalsDate(d1, d2, message) {
equal(d1.toString(), d2.toString(), message);
}
-function equalsDateArray(a1, a2, message) {
- if (!a1 || !a2) {
- ok(false, message + ' - missing dates');
- return;
- }
- a1[0] = (a1[0] ? new Date(a1[0].getFullYear(), a1[0].getMonth(), a1[0].getDate()) : '');
- 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()) : '');
- deepEqual(a1, a2, message);
-}
-
-function addMonths(date, offset) {
+TestHelpers.addMonths = function(date, offset) {
var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
date.setDate(Math.min(date.getDate(), maxDay));
date.setMonth(date.getMonth() + offset);
return date;
-}
+};
function init(id, options) {
$.datepicker.setDefaults($.datepicker.regional['']);
return $(id).datepicker($.extend({showAnim: ''}, options || {}));
}
-var PROP_NAME = 'datepicker';
+TestHelpers.PROP_NAME = 'datepicker';
(function($) {
diff --git a/tests/unit/datepicker/datepicker_defaults.js b/tests/unit/datepicker/datepicker_defaults.js
index 28e150791..1e7d90852 100644
--- a/tests/unit/datepicker/datepicker_defaults.js
+++ b/tests/unit/datepicker/datepicker_defaults.js
@@ -2,8 +2,10 @@
* datepicker_defaults.js
*/
+/*
var datepicker_defaults = {
disabled: false
};
-//TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+*/
diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js
index e35be62ce..b71067472 100644
--- a/tests/unit/datepicker/datepicker_events.js
+++ b/tests/unit/datepicker/datepicker_events.js
@@ -30,7 +30,7 @@ test('events', function() {
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(selectedThis, inp[0], 'Callback selected this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback selected inst');
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date');
inp.val('').datepicker('show').
@@ -59,7 +59,7 @@ test('events', function() {
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
equal(selectedThis, inp[0], 'Callback change month/year this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback change month/year inst');
equal(selectedDate, newMonthYear(date),
'Callback change month/year date - pgup');
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
@@ -107,7 +107,7 @@ test('events', function() {
val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], 'Callback close this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback close inst');
equal(selectedDate, '', 'Callback close date - esc');
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js
index e7aa7602e..5e692d1a0 100644
--- a/tests/unit/datepicker/datepicker_methods.js
+++ b/tests/unit/datepicker/datepicker_methods.js
@@ -10,56 +10,56 @@ test('destroy', function() {
var inl,
inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Default - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance present');
ok(inp.next().is('#alt'), 'Default - button absent');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Default - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance absent');
ok(inp.next().is('#alt'), 'Default - button absent');
// With button
inp= init('#inp', {showOn: 'both'});
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Button - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance present');
ok(inp.next().text() === '...', 'Button - button added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Button - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance absent');
ok(inp.next().is('#alt'), 'Button - button removed');
// With append text
inp = init('#inp', {appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Append - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance present');
ok(inp.next().text() === 'Testing', 'Append - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Append - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance absent');
ok(inp.next().is('#alt'), 'Append - append text removed');
// With both
inp= init('#inp', {showOn: 'both', buttonImageOnly: true,
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Both - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance present');
ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
ok(inp.next().next().text() === 'Testing', 'Both - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance absent');
ok(inp.next().is('#alt'), 'Both - button and append text absent');
// Inline
inl = init('#inl');
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
ok(inl.html() !== '', 'Inline - datepicker present');
- ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
+ ok($.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance present');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
inl.datepicker('destroy');
inl = $('#inl');
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
ok(inl.html() === '', 'Inline - datepicker absent');
- ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
+ ok(!$.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance absent');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
});
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index a01b9c7e0..7d3217364 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -8,7 +8,7 @@ module("datepicker: options");
test('setDefaults', function() {
expect( 3 );
- var inp = init('#inp');
+ init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'});
equal($.datepicker._defaults.showOn, 'button', 'Change default showOn');
@@ -19,7 +19,7 @@ test('setDefaults', function() {
test('option', function() {
expect( 17 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
// Set option
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
@@ -51,7 +51,7 @@ test('option', function() {
test('change', function() {
expect( 12 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
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');
@@ -215,12 +215,12 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), -1);
+ date = TestHelpers.addMonths(new Date(), -1);
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
inp.datepicker('option', {defaultDate: '+2M'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 2);
+ date = TestHelpers.addMonths(new Date(), 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show').
@@ -236,7 +236,7 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
// String date values
@@ -380,7 +380,7 @@ test('minMax', function() {
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
inp.val('').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
@@ -665,16 +665,6 @@ function beforeDay(date) {
(date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
}
-function calcWeek(date) {
- var doy = date.getDate() + 6,
- m = date.getMonth() - 1;
- for (; m >= 0; m--) {
- doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
- }
- // Simple count from 01/01 starting at week 1
- return Math.floor(doy / 7);
-}
-
test('callbacks', function() {
expect( 13 );
// Before show
diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js
index 57b25c3ff..ff5dfde63 100644
--- a/tests/unit/datepicker/datepicker_tickets.js
+++ b/tests/unit/datepicker/datepicker_tickets.js
@@ -8,7 +8,7 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
expect( 3 );
- var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
+ var inp = init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
// contains non-breaking space
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js
index e0a5c8701..a9e5e9be2 100644
--- a/tests/unit/dialog/dialog_core.js
+++ b/tests/unit/dialog/dialog_core.js
@@ -12,13 +12,13 @@ function dlg() {
return el.dialog('widget');
}
-function isOpen(why) {
+TestHelpers.isOpen = function(why) {
ok(dlg().is(":visible"), why);
-}
+};
-function isNotOpen(why) {
+TestHelpers.isNotOpen = function(why) {
ok(!dlg().is(":visible"), why);
-}
+};
function drag(handle, dx, dy) {
var d = dlg();
@@ -38,51 +38,43 @@ function drag(handle, dx, dy) {
widthAfter = d.width();
}
-function moved(dx, dy, msg) {
+TestHelpers.dialogMoved = function(dx, dy, msg) {
msg = msg ? msg + "." : "";
var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) },
expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) };
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
-}
+};
-function shouldmove(why) {
+TestHelpers.shouldmove = function(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50);
- moved(50, -50, why);
-}
+ TestHelpers.dialogMoved(50, -50, why);
+};
-function shouldnotmove(why) {
+TestHelpers.shouldnotmove = function(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50);
- moved(0, 0, why);
-}
+ TestHelpers.dialogMoved(0, 0, why);
+};
-function resized(dw, dh, msg) {
+TestHelpers.resized = function(dw, dh, msg) {
msg = msg ? msg + "." : "";
var actual = { width: widthAfter, height: heightAfter },
expected = { width: widthBefore + dw, height: heightBefore + dh };
deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
-}
+};
-function shouldresize(why) {
+TestHelpers.shouldresize = function(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
- resized(50, 50, why);
-}
+ TestHelpers.resized(50, 50, why);
+};
-function shouldnotresize(why) {
+TestHelpers.shouldnotresize = function(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
- resized(0, 0, why);
-}
-
-function broder(el, side){
- return parseInt(el.css('border-' + side + '-width'), 10);
-}
-
-function margin(el, side) {
- return parseInt(el.css('margin-' + side), 10);
-}
+ TestHelpers.resized(0, 0, why);
+};
(function($) {
diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js
index 515bebdc1..38b75a714 100644
--- a/tests/unit/dialog/dialog_events.js
+++ b/tests/unit/dialog/dialog_events.js
@@ -244,7 +244,7 @@ test("beforeClose", function() {
}
});
el.dialog('close');
- isOpen('beforeClose callback should prevent dialog from closing');
+ TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove();
el = $('<div></div>').dialog();
@@ -256,7 +256,7 @@ test("beforeClose", function() {
return false;
});
el.dialog('close');
- isOpen('beforeClose callback should prevent dialog from closing');
+ TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove();
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
@@ -266,7 +266,7 @@ test("beforeClose", function() {
return false;
});
el.dialog('close');
- isOpen('dialogbeforeclose event should prevent dialog from closing');
+ TestHelpers.isOpen('dialogbeforeclose event should prevent dialog from closing');
el.remove();
});
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js
index ba0c2bd41..3c80a9bea 100644
--- a/tests/unit/dialog/dialog_methods.js
+++ b/tests/unit/dialog/dialog_methods.js
@@ -25,7 +25,7 @@ test("init", function() {
ok(true, '.dialog() called on disconnected DOMElement - removed');
el = $('<div></div>').dialog();
- var foo = el.dialog("option", "foo");
+ el.dialog("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js
index ba217c6f4..1c823868e 100644
--- a/tests/unit/dialog/dialog_options.js
+++ b/tests/unit/dialog/dialog_options.js
@@ -9,11 +9,11 @@ test("autoOpen", function() {
expect(2);
el = $('<div></div>').dialog({ autoOpen: false });
- isNotOpen('.dialog({ autoOpen: false })');
+ TestHelpers.isNotOpen('.dialog({ autoOpen: false })');
el.remove();
el = $('<div></div>').dialog({ autoOpen: true });
- isOpen('.dialog({ autoOpen: true })');
+ TestHelpers.isOpen('.dialog({ autoOpen: true })');
el.remove();
});
@@ -22,12 +22,12 @@ test("buttons", function() {
var btn, i, newButtons,
buttons = {
- "Ok": function(ev, ui) {
+ "Ok": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target");
},
- "Cancel": function(ev, ui) {
+ "Cancel": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[1], "event target");
@@ -39,7 +39,7 @@ test("buttons", function() {
equal(btn.length, 2, "number of buttons");
i = 0;
- $.each(buttons, function(key, val) {
+ $.each(buttons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1));
i++;
});
@@ -50,7 +50,7 @@ test("buttons", function() {
btn.trigger("click");
newButtons = {
- "Close": function(ev, ui) {
+ "Close": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target");
@@ -66,7 +66,7 @@ test("buttons", function() {
btn.trigger('click');
i = 0;
- $.each(newButtons, function(key, val) {
+ $.each(newButtons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1));
i += 1;
});
@@ -166,15 +166,15 @@ test("draggable", function() {
expect(4);
el = $('<div></div>').dialog({ draggable: false });
- shouldnotmove();
+ TestHelpers.shouldnotmove();
el.dialog('option', 'draggable', true);
- shouldmove();
+ TestHelpers.shouldmove();
el.remove();
el = $('<div></div>').dialog({ draggable: true });
- shouldmove();
+ TestHelpers.shouldmove();
el.dialog('option', 'draggable', false);
- shouldnotmove();
+ TestHelpers.shouldnotmove();
el.remove();
});
@@ -395,15 +395,15 @@ test("resizable", function() {
expect(4);
el = $('<div></div>').dialog();
- shouldresize("[default]");
+ TestHelpers.shouldresize("[default]");
el.dialog('option', 'resizable', false);
- shouldnotresize('disabled after init');
+ TestHelpers.shouldnotresize('disabled after init');
el.remove();
el = $('<div></div>').dialog({ resizable: false });
- shouldnotresize("disabled in init options");
+ TestHelpers.shouldnotresize("disabled in init options");
el.dialog('option', 'resizable', true);
- shouldresize('enabled after init');
+ TestHelpers.shouldresize('enabled after init');
el.remove();
});
diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js
index e17d55a15..cf4ab0219 100644
--- a/tests/unit/dialog/dialog_tickets.js
+++ b/tests/unit/dialog/dialog_tickets.js
@@ -39,18 +39,18 @@ test("#4826: setting resizable false toggles resizable on dialog", function() {
var i;
el = $('<div></div>').dialog({ resizable: false });
- shouldnotresize("[default]");
+ TestHelpers.shouldnotresize("[default]");
for (i=0; i<2; i++) {
el.dialog('close').dialog('open');
- shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
+ TestHelpers.shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
}
el.remove();
el = $('<div></div>').dialog({ resizable: true });
- shouldresize("[default]");
+ TestHelpers.shouldresize("[default]");
for (i=0; i<2; i++) {
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
- shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
+ TestHelpers.shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
}
el.remove();
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js
index 9193881ad..80d9ca83e 100644
--- a/tests/unit/draggable/draggable_core.js
+++ b/tests/unit/draggable/draggable_core.js
@@ -5,7 +5,6 @@
var el, offsetBefore, offsetAfter, dragged;
function drag(handle, dx, dy) {
- var element = el.data("draggable").element;
offsetBefore = el.offset();
$(handle).simulate("drag", {
dx: dx || 0,
@@ -22,8 +21,8 @@ function moved(dx, dy, msg) {
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
-function restoreScroll(what) {
- if(what) {
+TestHelpers.restoreScroll = function( what ) {
+ if( what ) {
$(document).scrollTop(0); $(document).scrollLeft(0);
} else {
$("#main")[0].scrollTop = 0; $("#main")[0].scrollLeft = 0;
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index ea4611d69..4f7781515 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -210,7 +210,7 @@ test("{ cursor: 'auto' }, default", function() {
el = $("#draggable2").draggable({
cursor: expected,
- start: function(event, ui) {
+ start: function() {
actual = getCursor();
}
});
@@ -234,7 +234,7 @@ test("{ cursor: 'move' }", function() {
el = $("#draggable2").draggable({
cursor: expected,
- start: function(event, ui) {
+ start: function() {
actual = getCursor();
}
});
@@ -449,7 +449,7 @@ test("{ helper: 'original' }, relative, with scroll offset on parent", function(
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
@@ -466,7 +466,7 @@ test("{ helper: 'original' }, relative, with scroll offset on root", function()
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
@@ -486,8 +486,8 @@ test("{ helper: 'original' }, relative, with scroll offset on root and parent",
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
@@ -504,7 +504,7 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function(
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
@@ -521,7 +521,7 @@ test("{ helper: 'original' }, absolute, with scroll offset on root", function()
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
@@ -541,8 +541,8 @@ test("{ helper: 'original' }, absolute, with scroll offset on root and parent",
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
@@ -559,7 +559,7 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() {
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
@@ -576,7 +576,7 @@ test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
@@ -595,8 +595,8 @@ test("{ helper: 'original' }, fixed, with scroll offset on root and parent", fun
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
@@ -639,7 +639,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
@@ -668,7 +668,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
@@ -698,8 +698,8 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll('root');
- restoreScroll();
+ TestHelpers.restoreScroll('root');
+ TestHelpers.restoreScroll();
});
@@ -710,7 +710,7 @@ test("{ opacity: 0.5 }", function() {
var opacity = null;
el = $("#draggable2").draggable({
opacity: 0.5,
- start: function(event, ui) {
+ start: function() {
opacity = $(this).css("opacity");
}
});
@@ -726,11 +726,11 @@ test("{ zIndex: 10 }", function() {
expect(1);
var actual,
- expected = 10,
- zIndex = null;
+ expected = 10;
+
el = $("#draggable2").draggable({
zIndex: expected,
- start: function(event, ui) {
+ start: function() {
actual = $(this).css("zIndex");
}
});
diff --git a/tests/unit/droppable/droppable_core.js b/tests/unit/droppable/droppable_core.js
index 3f709d25d..1ec50eecc 100644
--- a/tests/unit/droppable/droppable_core.js
+++ b/tests/unit/droppable/droppable_core.js
@@ -2,15 +2,15 @@
* droppable_core.js
*/
-var el, drg;
+var el;
-function shouldBeDroppable() {
+TestHelpers.shouldBeDroppable = function() {
ok(false, 'missing test - untested code is broken code');
-}
+};
-function shouldNotBeDroppable() {
+TestHelpers.shouldNotBeDroppable = function() {
ok(false, 'missing test - untested code is broken code');
-}
+};
(function($) {
@@ -27,7 +27,7 @@ test("element types", function() {
el = $(document.createElement(typeName)).appendTo('body');
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
el.droppable();
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("destroy");
el.remove();
});
diff --git a/tests/unit/droppable/droppable_events.js b/tests/unit/droppable/droppable_events.js
index f22a03540..2e01b0c9c 100644
--- a/tests/unit/droppable/droppable_events.js
+++ b/tests/unit/droppable/droppable_events.js
@@ -5,6 +5,10 @@
module("droppable: events");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
test("activate", function() {
ok(false, 'missing test - untested code is broken code');
});
diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js
index 8fd49d265..51581b425 100644
--- a/tests/unit/droppable/droppable_methods.js
+++ b/tests/unit/droppable/droppable_methods.js
@@ -48,16 +48,16 @@ test("destroy", function() {
test("enable", function() {
expect(7);
el = $("#droppable1").droppable({ disabled: true });
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
el.droppable("enable");
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
equal(el.droppable("option", "disabled"), false, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: true });
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
el.droppable("option", "disabled", false);
equal(el.droppable("option", "disabled"), false, "disabled option setter");
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
var expected = $('<div></div>').droppable(),
actual = expected.droppable('enable');
@@ -67,16 +67,16 @@ test("enable", function() {
test("disable", function() {
expect(7);
el = $("#droppable1").droppable({ disabled: false });
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("disable");
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
equal(el.droppable("option", "disabled"), true, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: false });
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("option", "disabled", true);
equal(el.droppable("option", "disabled"), true, "disabled option setter");
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
var expected = $('<div></div>').droppable(),
actual = expected.droppable('disable');
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index c4e5c24f9..26390b7d3 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -12,10 +12,7 @@ function notPresent( value, array, message ) {
var minDuration = 15,
// duration is used for "long" animates where we plan on testing properties during animation
- duration = 200,
-
- // mid is used for testing in the "middle" of the "duration" animations
- mid = duration / 2;
+ duration = 200;
module( "effects.core" );
@@ -58,8 +55,7 @@ test( "createWrapper and removeWrapper retain focused elements (#7595)", functio
module( "effects.core: animateClass" );
asyncTest( "animateClass works with borderStyle", function() {
- var test = $("div.animateClass"),
- count = 0;
+ var test = $("div.animateClass");
expect(3);
test.toggleClass("testAddBorder", minDuration, function() {
test.toggleClass("testAddBorder", minDuration, function() {
@@ -73,8 +69,8 @@ asyncTest( "animateClass works with borderStyle", function() {
asyncTest( "animateClass works with colors", function() {
var test = $("div.animateClass"),
- count = 0,
oldStep = jQuery.fx.step.backgroundColor;
+
expect(2);
// we want to catch the first frame of animation
@@ -102,7 +98,7 @@ asyncTest( "animateClass works with colors", function() {
asyncTest( "animateClass calls step option", 1, function() {
var test = jQuery( "div.animateClass" ),
- step = function( fx ) {
+ step = function() {
ok( true, "Step Function Called" );
test.stop();
start();
@@ -216,7 +212,7 @@ $.each( $.effects.effect, function( effect ) {
equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
})).queue( queueTest() ).hide( effect, minDuration, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
- })).queue( queueTest(function(next) {
+ })).queue( queueTest(function() {
deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
start();
}));
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index d69fc46a3..a94968138 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -13,7 +13,7 @@ module( "menu: events", {
test( "handle click on menu", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
}
});
@@ -29,7 +29,7 @@ test( "handle click on menu", function() {
test( "handle click on custom item menu", function() {
expect( 1 );
var element = $( "#menu5" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
},
menus: "div"
@@ -47,7 +47,7 @@ asyncTest( "handle blur", function() {
expect( 1 );
var blurHandled = false,
element = $( "#menu1" ).menu({
- blur: function( event, ui ) {
+ blur: function( event ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
blurHandled = true;
@@ -69,7 +69,7 @@ asyncTest( "handle blur via click outside", function() {
expect( 1 );
var blurHandled = false,
element = $( "#menu1" ).menu({
- blur: function( event, ui ) {
+ blur: function( event ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
blurHandled = true;
@@ -90,7 +90,7 @@ asyncTest( "handle blur via click outside", function() {
test( "handle focus of menu with active item", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -168,7 +168,7 @@ test( "handle keyboard navigation on menu without scroll and without submenus",
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
@@ -230,13 +230,13 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus"
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
@@ -350,7 +350,7 @@ test( "handle keyboard navigation on menu with scroll and without submenus", fun
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
@@ -421,13 +421,13 @@ asyncTest( "handle keyboard navigation on menu with scroll and with submenus", f
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
@@ -516,13 +516,13 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( logOutput(), "keydown,1", "Keydown focus but not select disabled item" );
@@ -564,13 +564,13 @@ asyncTest( "handle keyboard navigation and mouse click on menu with disabled ite
test( "handle keyboard navigation with spelling of menu items", function() {
expect( 2 );
var element = $( "#menu2" ).menu({
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: 65 } );
element.simulate( "keydown", { keyCode: 68 } );
element.simulate( "keydown", { keyCode: 68 } );
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
index f9241f27b..c49783c3e 100644
--- a/tests/unit/menu/menu_methods.js
+++ b/tests/unit/menu/menu_methods.js
@@ -29,7 +29,7 @@ test( "destroy", function() {
test( "enable/disable", function() {
expect( 3 );
var element = $( "#menu1" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
}
});
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
index a8b029201..2c8749e3c 100644
--- a/tests/unit/menu/menu_options.js
+++ b/tests/unit/menu/menu_options.js
@@ -14,7 +14,7 @@ test( "{ disabled: true }", function() {
expect( 2 );
var element = $( "#menu1" ).menu({
disabled: true,
- select: function(event, ui) {
+ select: function() {
log();
}
});
@@ -29,7 +29,7 @@ test( "{ disabled: false }", function() {
expect( 2 );
var element = $( "#menu1" ).menu({
disabled: false,
- select: function( event, ui ) {
+ select: function() {
log();
}
});
diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js
index aef2ae15c..8cc6cec82 100644
--- a/tests/unit/resizable/resizable_core.js
+++ b/tests/unit/resizable/resizable_core.js
@@ -2,9 +2,7 @@
* resizable_core.js
*/
-var el;
-
-var drag = function(el, dx, dy, complete) {
+TestHelpers.resizableDrag = function(el, dx, dy, complete) {
// speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated.
@@ -46,10 +44,10 @@ test("n", function() {
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 0, -50);
+ TestHelpers.resizableDrag(handle, 0, -50);
equal( target.height(), 150, "compare height" );
- drag(handle, 0, 50);
+ TestHelpers.resizableDrag(handle, 0, 50);
equal( target.height(), 100, "compare height" );
});
@@ -58,10 +56,10 @@ test("s", function() {
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 0, 50);
+ TestHelpers.resizableDrag(handle, 0, 50);
equal( target.height(), 150, "compare height" );
- drag(handle, 0, -50);
+ TestHelpers.resizableDrag(handle, 0, -50);
equal( target.height(), 100, "compare height" );
});
@@ -70,10 +68,10 @@ test("e", function() {
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 50);
+ TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 150, "compare width");
- drag(handle, -50);
+ TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 100, "compare width" );
});
@@ -82,10 +80,10 @@ test("w", function() {
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50);
+ TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 150, "compare width" );
- drag(handle, 50);
+ TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 100, "compare width" );
});
@@ -94,11 +92,11 @@ test("ne", function() {
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
@@ -108,11 +106,11 @@ test("se", function() {
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
@@ -122,11 +120,11 @@ test("sw", function() {
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
@@ -136,11 +134,11 @@ test("nw", function() {
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
diff --git a/tests/unit/resizable/resizable_events.js b/tests/unit/resizable/resizable_events.js
index 52d55731c..d7793ff2f 100644
--- a/tests/unit/resizable/resizable_events.js
+++ b/tests/unit/resizable/resizable_events.js
@@ -5,4 +5,8 @@
module("resizable: events");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
})(jQuery);
diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js
index 87859acf7..b12f3035a 100644
--- a/tests/unit/resizable/resizable_methods.js
+++ b/tests/unit/resizable/resizable_methods.js
@@ -5,5 +5,8 @@
module("resizable: methods");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
})(jQuery);
diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js
index e10a55a31..c17f329fd 100644
--- a/tests/unit/resizable/resizable_options.js
+++ b/tests/unit/resizable/resizable_options.js
@@ -10,11 +10,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -130);
+ TestHelpers.resizableDrag(handle, -130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -24,11 +24,11 @@ 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);
+ TestHelpers.resizableDrag(handle, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 130);
+ TestHelpers.resizableDrag(handle, 130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -38,11 +38,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 0, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 0, 80);
+ TestHelpers.resizableDrag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -52,11 +52,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 0, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 0, -80);
+ TestHelpers.resizableDrag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -66,11 +66,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -80, -80);
+ TestHelpers.resizableDrag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -80,11 +80,11 @@ 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);
+ TestHelpers.resizableDrag(handle, -80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 80, -80);
+ TestHelpers.resizableDrag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -94,11 +94,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 80, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -80, 80);
+ TestHelpers.resizableDrag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
@@ -108,11 +108,11 @@ test("grid", function() {
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
- drag(handle, 3, 9);
+ TestHelpers.resizableDrag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- drag(handle, 15, 11);
+ TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
@@ -122,11 +122,11 @@ test("grid (wrapped)", function() {
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
- drag(handle, 3, 9);
+ TestHelpers.resizableDrag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- drag(handle, 15, 11);
+ TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
@@ -136,11 +136,11 @@ 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);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, 70, 70);
+ TestHelpers.resizableDrag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -150,11 +150,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, -70, 70);
+ TestHelpers.resizableDrag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -164,11 +164,11 @@ 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);
+ TestHelpers.resizableDrag(handle, -50, 50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, 70, -70);
+ TestHelpers.resizableDrag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
@@ -178,11 +178,11 @@ 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);
+ TestHelpers.resizableDrag(handle, 70, 70);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, -70, -70);
+ TestHelpers.resizableDrag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
diff --git a/tests/unit/selectable/selectable_core.js b/tests/unit/selectable/selectable_core.js
index 18ea3a302..d2e885fc7 100644
--- a/tests/unit/selectable/selectable_core.js
+++ b/tests/unit/selectable/selectable_core.js
@@ -4,7 +4,7 @@
var el;
-var drag = function(dx, dy) {
+TestHelpers.selectableDrag = function drag(dx, dy) {
var off = el.offset(), pos = { clientX: off.left, clientY: off.top };
el.simulate("mousedown", pos);
$(document).simulate("mousemove", pos);
diff --git a/tests/unit/selectable/selectable_events.js b/tests/unit/selectable/selectable_events.js
index 2623818a7..bfd431bd8 100644
--- a/tests/unit/selectable/selectable_events.js
+++ b/tests/unit/selectable/selectable_events.js
@@ -9,7 +9,7 @@ test("start", function() {
expect(2);
el = $("#selectable1");
el.selectable({
- start: function(ev, ui) {
+ start: function() {
ok(true, "drag fired start callback");
equal(this, el[0], "context of callback");
}
@@ -21,7 +21,7 @@ test("stop", function() {
expect(2);
el = $("#selectable1");
el.selectable({
- start: function(ev, ui) {
+ start: function() {
ok(true, "drag fired stop callback");
equal(this, el[0], "context of callback");
}
diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js
index dbc88f269..ee7242d9b 100644
--- a/tests/unit/selectable/selectable_methods.js
+++ b/tests/unit/selectable/selectable_methods.js
@@ -21,7 +21,7 @@ test("init", function() {
ok(true, 'arbitrary method called after init');
el = $("<div></div>").selectable();
- var foo = el.selectable("option", "foo");
+ el.selectable("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
diff --git a/tests/unit/selectable/selectable_options.js b/tests/unit/selectable/selectable_options.js
index be9fdf5fe..ad57000a9 100644
--- a/tests/unit/selectable/selectable_options.js
+++ b/tests/unit/selectable/selectable_options.js
@@ -13,7 +13,7 @@ test("autoRefresh", function() {
actual = 0;
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
sel.hide();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length);
el.selectable("destroy");
@@ -21,10 +21,10 @@ test("autoRefresh", function() {
sel.show();
el = $("#selectable1").selectable({ autoRefresh: true, selected: selected });
sel.hide();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, 0);
sel.show();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length);
el.selectable("destroy");
sel.show();
@@ -37,7 +37,7 @@ test("filter", function() {
actual = 0;
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
ok(sel.length !== 1, "this test assumes more than 1 selectee");
equal(actual, 1);
el.selectable("destroy");
diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js
index 4d0896442..2fb9b37b6 100644
--- a/tests/unit/slider/slider_events.js
+++ b/tests/unit/slider/slider_events.js
@@ -14,16 +14,16 @@ test( "mouse based interaction", function() {
var el = $( "#slider1" )
.slider({
- start: function(event, ui) {
+ start: function( event ) {
equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" );
},
- slide: function(event, ui) {
+ slide: function( event) {
equal( event.originalEvent.type, "mousemove", "slider triggered by mousemove" );
},
- stop: function(event, ui) {
+ stop: function( event ) {
equal( event.originalEvent.type, "mouseup", "stop triggered by mouseup" );
},
- change: function(event, ui) {
+ change: function( event ) {
equal( event.originalEvent.type, "mouseup", "change triggered by mouseup" );
}
});
@@ -38,16 +38,16 @@ test( "keyboard based interaction", function() {
// Test keyup at end of handle slide (keyboard)
var el = $( "#slider1" )
.slider({
- start: function(event, ui) {
+ start: function( event ) {
equal( event.originalEvent.type, "keydown", "start triggered by keydown" );
},
- slide: function(event, ui) {
+ slide: function() {
ok( false, "Slider never triggered by keys" );
},
- stop: function(event, ui) {
+ stop: function( event ) {
equal( event.originalEvent.type, "keyup", "stop triggered by keyup" );
},
- change: function(event, ui) {
+ change: function( event ) {
equal( event.originalEvent.type, "keyup", "change triggered by keyup" );
}
});
@@ -64,7 +64,7 @@ test( "programmatic event triggers", function() {
// Test value method
var el = $( "<div></div>" )
.slider({
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by value method" );
}
})
@@ -75,7 +75,7 @@ test( "programmatic event triggers", function() {
el = $( "<div></div>" )
.slider({
values: [ 10, 20 ],
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by values method" );
}
})
@@ -85,7 +85,7 @@ test( "programmatic event triggers", function() {
// Test value option
el = $( "<div></div>" )
.slider({
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by value option" );
}
})
@@ -96,7 +96,7 @@ test( "programmatic event triggers", function() {
el = $( "<div></div>" )
.slider({
values: [ 10, 20 ],
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by values option" );
}
})
diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js
index 1a6b493c9..11d679845 100644
--- a/tests/unit/slider/slider_methods.js
+++ b/tests/unit/slider/slider_methods.js
@@ -17,8 +17,8 @@ test("init", function() {
$('<div></div>').slider().remove();
ok(true, '.slider() called on disconnected DOMElement');
- var el = $('<div></div>').slider(),
- foo = el.slider("option", "foo");
+ var el = $('<div></div>').slider();
+ el.slider("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js
index ff1859874..540e06f0f 100644
--- a/tests/unit/sortable/sortable_core.js
+++ b/tests/unit/sortable/sortable_core.js
@@ -6,4 +6,8 @@
module("sortable: core");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
})(jQuery);
diff --git a/tests/unit/sortable/sortable_options.js b/tests/unit/sortable/sortable_options.js
index a043e68fe..d5d7b3de1 100644
--- a/tests/unit/sortable/sortable_options.js
+++ b/tests/unit/sortable/sortable_options.js
@@ -5,6 +5,10 @@
module("sortable: options");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
test("{ appendTo: 'parent' }, default", function() {
ok(false, "missing test - untested code is broken code.");
});
diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js
index 22ad61baf..14bb705ea 100644
--- a/tests/unit/sortable/sortable_tickets.js
+++ b/tests/unit/sortable/sortable_tickets.js
@@ -44,13 +44,13 @@ test('#4752: link event firing on sortable with connect list', function () {
$('#main ul').sortable({
connectWith: '#main ul',
- change: function (e, ui) {
+ change: function () {
fired.change = true;
},
- receive: function (e, ui) {
+ receive: function () {
fired.receive = true;
},
- remove: function (e, ui) {
+ remove: function () {
fired.remove = true;
}
});
diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js
index 1f6646a33..284e03a3e 100644
--- a/tests/unit/spinner/spinner_options.js
+++ b/tests/unit/spinner/spinner_options.js
@@ -1,7 +1,5 @@
(function( $ ) {
-var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
-
module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat
@@ -28,7 +26,7 @@ test( "icons: custom ", function() {
test( "incremental, false", function() {
expect( 100 );
- var i, diff,
+ var i,
prev = 0,
element = $( "#spin" ).val( prev ).spinner({
incremental: false,
@@ -53,7 +51,7 @@ test( "incremental, true", function() {
});
}
- var i, diff,
+ var i,
prev = 0,
expected = [].concat( fill( 18, 1 ), fill( 37, 2 ), fill( 14, 3 ),
fill( 9, 4 ), fill( 6, 5 ), fill( 5, 6 ), fill ( 5, 7 ),
diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js
index 5dbe1d6b1..6307c4488 100644
--- a/tests/unit/tabs/tabs_core.js
+++ b/tests/unit/tabs/tabs_core.js
@@ -132,7 +132,6 @@ test( "accessibility", function() {
asyncTest( "accessibility - ajax", function() {
expect( 4 );
var element = $( "#tabs2" ).tabs(),
- tab = element.find( ".ui-tabs-nav li" ).eq( 3 ),
panel = $( "#custom-id" );
equal( panel.attr( "aria-live" ), "polite", "remote panel has aria-live" );
@@ -588,7 +587,7 @@ asyncTest( "keyboard support - CTRL+UP, ALT+PAGE_DOWN, ALT+PAGE_UP", function()
test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
expect( 1 );
- var element = $( "#tabs2" ).tabs({
+ $( "#tabs2" ).tabs({
active: 2,
beforeLoad: function( event, ui ) {
event.preventDefault();
@@ -603,7 +602,7 @@ test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", funct
var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
element.appendTo( "#main" );
element.tabs({
- beforeLoad: function( event, ui ) {
+ beforeLoad: function() {
event.preventDefault();
ok( false, "should not be an ajax tab" );
}
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index 4a938c078..297a4546e 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -53,20 +53,20 @@ asyncTest( "cache", function() {
var element = $( "#tabs2" ).tabs({
cache: true
});
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
ok( true, "tabsload" );
setTimeout(function() {
element.tabs( "option", "active", 0 );
state( element, 1, 0, 0, 0, 0 );
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
ok( false, "should be cached" );
});
element.tabs( "option", "active", 2 );
@@ -159,10 +159,10 @@ asyncTest( "spinner", function() {
var element = $( "#tabs2" ).tabs();
- element.one( "tabsbeforeload", function( event, ui ) {
+ element.one( "tabsbeforeload", function() {
equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
// wait until after the load finishes before checking for the spinner to be removed
setTimeout(function() {
equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
@@ -351,7 +351,7 @@ test( "show", function() {
state( element, 0, 1, 0 );
// collapsing
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
@@ -391,7 +391,7 @@ test( "select", function() {
state( element, 0, 1, 0 );
// collapsing
- element.one( "tabsselect", function( event, ui ) {
+ element.one( "tabsselect", function() {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js
index 74a561c0d..c0ab490e1 100644
--- a/tests/unit/testsuite.js
+++ b/tests/unit/testsuite.js
@@ -116,7 +116,7 @@ function testWidgetDefaults( widget, defaults ) {
// ensure that all defaults were tested
test( "tested defaults", function() {
var count = 0;
- $.each( pluginDefaults, function( key, val ) {
+ $.each( pluginDefaults, function( key ) {
expect( ++count );
ok( key in defaults, key );
});
@@ -227,7 +227,7 @@ window.domEqual = function( selector, modifier, message ) {
delete result.data[ $.expando ];
children = elem.children();
if ( children.length ) {
- result.children = elem.children().map(function( ind ) {
+ result.children = elem.children().map(function() {
return extract( $( this ) );
}).get();
} else {
diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js
index e5046f464..3be651855 100644
--- a/tests/unit/tooltip/tooltip_options.js
+++ b/tests/unit/tooltip/tooltip_options.js
@@ -67,7 +67,7 @@ test( "content: change while open", function() {
test( "content: string", function() {
expect( 1 );
- var element = $( "#tooltipped1" ).tooltip({
+ $( "#tooltipped1" ).tooltip({
content: "just a string",
open: function( event, ui ) {
equal( ui.tooltip.text(), "just a string" );
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 5efd91268..848579a1d 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -313,7 +313,7 @@ test( "re-init", function() {
_init: function() {
actions.push( "init" );
},
- _setOption: function( key, value ) {
+ _setOption: function( key ) {
actions.push( "option" + key );
}
});
@@ -959,11 +959,11 @@ test( "._trigger() - cancelled event", function() {
});
$( "#widget" ).testWidget({
- foo: function( event, ui ) {
+ foo: function() {
ok( true, "callback invoked even if event is cancelled" );
}
})
- .bind( "testwidgetfoo", function( event, ui ) {
+ .bind( "testwidgetfoo", function() {
ok( true, "event was triggered" );
return false;
});
@@ -978,7 +978,7 @@ test( "._trigger() - cancelled callback", function() {
});
$( "#widget" ).testWidget({
- foo: function( event, ui ) {
+ foo: function() {
return false;
}
});
diff --git a/ui/.jshintrc b/ui/.jshintrc
index 26b808774..edf09721b 100644
--- a/ui/.jshintrc
+++ b/ui/.jshintrc
@@ -10,6 +10,7 @@
"onevar": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
"Globalize"
]
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index a23d5e66d..108647419 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -603,7 +603,7 @@ if ( $.uiBackCompat !== false ) {
_create.call( this );
},
- _setOption: function( key, value ) {
+ _setOption: function( key ) {
if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
this.options.heightStyle = this._mergeHeightStyle();
}
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index aec12bf8f..7bacca006 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -359,7 +359,7 @@ $.widget( "ui.autocomplete", {
url: url,
data: request,
dataType: "json",
- success: function( data, status ) {
+ success: function( data ) {
response( data );
},
error: function() {
@@ -541,7 +541,7 @@ $.widget( "ui.autocomplete", {
return this.menu.element;
},
- _value: function( value ) {
+ _value: function() {
return this.valueMethod.apply( this.element, arguments );
},
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index e234464ad..f2e3f945f 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -88,6 +88,11 @@ $.widget("ui.dialog", {
options = this.options,
title = options.title || "&#160;",
+ uiDialog,
+ uiDialogTitlebar,
+ uiDialogTitlebarClose,
+ uiDialogTitle,
+ uiDialogButtonPane;
uiDialog = ( this.uiDialog = $( "<div>" ) )
.addClass( uiDialogClasses + options.dialogClass )
@@ -108,13 +113,13 @@ $.widget("ui.dialog", {
.mousedown(function( event ) {
that.moveToTop( false, event );
})
- .appendTo( "body" ),
+ .appendTo( "body" );
- uiDialogContent = this.element
+ this.element
.show()
.removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" )
- .appendTo( uiDialog ),
+ .appendTo( uiDialog );
uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
.addClass( "ui-dialog-titlebar ui-widget-header " +
@@ -123,7 +128,7 @@ $.widget("ui.dialog", {
// Dialog isn't getting focus when dragging (#8063)
uiDialog.focus();
})
- .prependTo( uiDialog ),
+ .prependTo( uiDialog );
uiDialogTitlebarClose = $( "<a href='#'></a>" )
.addClass( "ui-dialog-titlebar-close ui-corner-all" )
@@ -132,23 +137,23 @@ $.widget("ui.dialog", {
event.preventDefault();
that.close( event );
})
- .appendTo( uiDialogTitlebar ),
+ .appendTo( uiDialogTitlebar );
- uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
.addClass( "ui-icon ui-icon-closethick" )
.text( options.closeText )
- .appendTo( uiDialogTitlebarClose ),
+ .appendTo( uiDialogTitlebarClose );
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
.html( title )
- .prependTo( uiDialogTitlebar ),
+ .prependTo( uiDialogTitlebar );
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
- .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
- uiButtonSet = ( this.uiButtonSet = $( "<div>" ) )
+ ( this.uiButtonSet = $( "<div>" ) )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );
@@ -350,8 +355,7 @@ $.widget("ui.dialog", {
},
_createButtons: function( buttons ) {
- var uiDialogButtonPane, uiButtonSet,
- that = this,
+ var that = this,
hasButtons = false;
// if we already have a button pane, remove it
diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js
index 8d875746e..37ca48795 100644
--- a/ui/jquery.ui.effect.js
+++ b/ui/jquery.ui.effect.js
@@ -245,8 +245,7 @@ color.fn = jQuery.extend( color.prototype, {
var inst = this,
type = jQuery.type( red ),
- rgba = this._rgba = [],
- source;
+ rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
@@ -427,7 +426,7 @@ color.fn = jQuery.extend( color.prototype, {
rgba.push( ~~( alpha * 255 ) );
}
- return "#" + jQuery.map( rgba, function( v, i ) {
+ return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
@@ -501,8 +500,7 @@ spaces.hsla.from = function ( hsla ) {
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
- p = 2 * l - q,
- r, g, b;
+ p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
@@ -710,7 +708,6 @@ function getElementStyles() {
this.currentStyle,
newStyle = {},
key,
- camelCase,
len;
// webkit enumerates style porperties
@@ -1114,7 +1111,7 @@ function standardSpeed( speed ) {
}
$.fn.extend({
- effect: function( effect, options, speed, callback ) {
+ effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode,
queue = args.queue,
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js
index eb0f7fc15..18f7113d4 100644
--- a/ui/jquery.ui.slider.js
+++ b/ui/jquery.ui.slider.js
@@ -278,7 +278,7 @@ $.widget( "ui.slider", $.ui.mouse, {
return true;
},
- _mouseStart: function( event ) {
+ _mouseStart: function() {
return true;
},
@@ -591,7 +591,7 @@ $.widget( "ui.slider", $.ui.mouse, {
_set = {};
if ( this.options.values && this.options.values.length ) {
- this.handles.each(function( i, j ) {
+ this.handles.each(function( i ) {
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 05456374d..0d920c3a1 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -45,8 +45,7 @@ $.widget( "ui.tabs", {
},
_create: function() {
- var panel,
- that = this,
+ var that = this,
options = this.options,
active = options.active,
locationHash = location.hash.substring( 1 );
@@ -295,8 +294,7 @@ $.widget( "ui.tabs", {
},
refresh: function() {
- var next,
- options = this.options,
+ var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
@@ -922,7 +920,7 @@ if ( $.uiBackCompat !== false ) {
this._super();
},
- url: function( index, url ){
+ url: function( index ){
this.anchors.eq( index ).removeData( "cache.tabs" );
this._superApply( arguments );
}
@@ -1158,7 +1156,7 @@ if ( $.uiBackCompat !== false ) {
}
},
- _eventHandler: function( event ) {
+ _eventHandler: function() {
this._superApply( arguments );
this.options.selected = this.options.active;
if ( this.options.selected === false ) {
@@ -1254,7 +1252,7 @@ if ( $.uiBackCompat !== false ) {
this._cookie( this.options.active, this.options.cookie );
}
},
- _eventHandler: function( event ) {
+ _eventHandler: function() {
this._superApply( arguments );
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 4a17f1f20..43788a082 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -284,7 +284,7 @@ $.widget( "ui.tooltip", {
this.close( fakeEvent, true );
}
},
- remove: function( event ) {
+ remove: function() {
this._removeTooltip( tooltip );
}
};
@@ -297,7 +297,7 @@ $.widget( "ui.tooltip", {
this._on( target, events );
},
- close: function( event, force ) {
+ close: function( event ) {
var that = this,
target = $( event ? event.currentTarget : this.element ),
tooltip = this._find( target );
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 96cc6071c..59fd81b9e 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -200,7 +200,7 @@ $.widget.bridge = function( name, object ) {
};
};
-$.Widget = function( options, element ) {};
+$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {