Build: Enable "unused" option in jshint - Remove unused variables from codebase. - Closes gh-788

Squashed commit of the following:

commit 7f19f92c64
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 257505a9e6
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Tue Oct 23 08:10:20 2012 -0400

    changes per @scott_gonzalez

commit 12725480cb
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Mon Oct 22 22:54:05 2012 -0400

    clean up unused vars in ui directory

commit 563595e7ae
Author: Mike Sherov <mike.sherov@gmail.com>
Date:   Mon Oct 22 22:37:42 2012 -0400

    clean up unused vars in grunt and tests
This commit is contained in:
Mike Sherov 2012-10-23 09:36:42 -05:00 committed by Corey Frang
parent 7af1ec727b
commit e1230997aa
56 changed files with 282 additions and 311 deletions

View File

@ -7,5 +7,6 @@
"node": true, "node": true,
"onevar": true, "onevar": true,
"trailing": true, "trailing": true,
"undef": true "undef": true,
"unused": true
} }

View File

@ -425,7 +425,7 @@ function abort( msg ) {
function walk( methods ) { function walk( methods ) {
var method = methods.shift(); var method = methods.shift();
function next( error ) { function next() {
if ( methods.length ) { if ( methods.length ) {
walk( methods ); walk( methods );
} }

View File

@ -146,7 +146,7 @@ grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
opts: { opts: {
cwd: 'dist' cwd: 'dist'
} }
}, function( err, result ) { }, function( err ) {
if ( err ) { if ( err ) {
grunt.log.error( err ); grunt.log.error( err );
done(); done();

View File

@ -11,8 +11,8 @@
"onevar": true, "onevar": true,
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"unused": true,
"predef": [ "predef": [
"addMonths",
"asyncTest", "asyncTest",
"container", "container",
"deepEqual", "deepEqual",
@ -29,8 +29,6 @@
"Globalize", "Globalize",
"heightAfter", "heightAfter",
"init", "init",
"isNotOpen",
"isOpen",
"modal", "modal",
"module", "module",
"moved", "moved",
@ -38,15 +36,7 @@
"offsetAfter", "offsetAfter",
"offsetBefore", "offsetBefore",
"ok", "ok",
"PROP_NAME",
"QUnit", "QUnit",
"restoreScroll",
"shouldBeDroppable",
"shouldmove",
"shouldNotBeDroppable",
"shouldnotmove",
"shouldnotresize",
"shouldresize",
"start", "start",
"strictEqual", "strictEqual",
"stop", "stop",

View File

@ -109,8 +109,7 @@ test( "allow form submit on enter when menu is not active", function() {
function arrowsMoveFocus( id, isKeyUp ) { function arrowsMoveFocus( id, isKeyUp ) {
expect( 1 ); expect( 1 );
var didMove = false, var element = $( id ).autocomplete({
element = $( id ).autocomplete({
source: [ "a" ], source: [ "a" ],
delay: 0, delay: 0,
minLength: 0 minLength: 0

View File

@ -39,7 +39,7 @@ $.each([
], "response ui.content" ); ], "response ui.content" );
ui.content.splice( 0, 1 ); ui.content.splice( 0, 1 );
}, },
open: function( event ) { open: function() {
ok( menu.is( ":visible" ), "menu open on open" ); ok( menu.is( ":visible" ), "menu open on open" );
}, },
focus: function( event, ui ) { focus: function( event, ui ) {
@ -127,7 +127,7 @@ asyncTest( "cancel focus", function() {
element = $( "#autocomplete" ).autocomplete({ element = $( "#autocomplete" ).autocomplete({
delay: 0, delay: 0,
source: data, source: data,
focus: function( event, ui ) { focus: function() {
$( this ).val( customVal ); $( this ).val( customVal );
return false; return false;
} }
@ -146,7 +146,7 @@ asyncTest( "cancel select", function() {
element = $( "#autocomplete" ).autocomplete({ element = $( "#autocomplete" ).autocomplete({
delay: 0, delay: 0,
source: data, source: data,
select: function( event, ui ) { select: function() {
$( this ).val( customVal ); $( this ).val( customVal );
return false; return false;
} }

View File

@ -33,7 +33,7 @@ function autoFocusTest( afValue, focusedLength ) {
autoFocus: afValue, autoFocus: afValue,
delay: 0, delay: 0,
source: data, source: data,
open: function( event, ui ) { open: function() {
equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length, equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length,
focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" ); focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" );
start(); start();

View File

@ -1,7 +1,7 @@
/* /*
* button_events.js * button_events.js
*/ */
(function($) { (function() {
module("button: events"); module("button: events");

View File

@ -12,31 +12,19 @@ function equalsDate(d1, d2, message) {
equal(d1.toString(), d2.toString(), message); equal(d1.toString(), d2.toString(), message);
} }
function equalsDateArray(a1, a2, message) { TestHelpers.addMonths = function(date, offset) {
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) {
var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate(); var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
date.setDate(Math.min(date.getDate(), maxDay)); date.setDate(Math.min(date.getDate(), maxDay));
date.setMonth(date.getMonth() + offset); date.setMonth(date.getMonth() + offset);
return date; return date;
} };
function init(id, options) { function init(id, options) {
$.datepicker.setDefaults($.datepicker.regional['']); $.datepicker.setDefaults($.datepicker.regional['']);
return $(id).datepicker($.extend({showAnim: ''}, options || {})); return $(id).datepicker($.extend({showAnim: ''}, options || {}));
} }
var PROP_NAME = 'datepicker'; TestHelpers.PROP_NAME = 'datepicker';
(function($) { (function($) {

View File

@ -2,8 +2,10 @@
* datepicker_defaults.js * datepicker_defaults.js
*/ */
/*
var datepicker_defaults = { var datepicker_defaults = {
disabled: false disabled: false
}; };
//TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults }); TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
*/

View File

@ -30,7 +30,7 @@ test('events', function() {
inp.val('').datepicker('show'). inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(selectedThis, inp[0], 'Callback selected this'); 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), equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date'); 'Callback selected date');
inp.val('').datepicker('show'). inp.val('').datepicker('show').
@ -59,7 +59,7 @@ test('events', function() {
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}); inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1); date.setMonth(date.getMonth() - 1);
equal(selectedThis, inp[0], 'Callback change month/year this'); 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), equal(selectedDate, newMonthYear(date),
'Callback change month/year date - pgup'); 'Callback change month/year date - pgup');
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
@ -107,7 +107,7 @@ test('events', function() {
val('').datepicker('show'). val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], 'Callback close this'); 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'); equal(selectedDate, '', 'Callback close date - esc');
inp.val('').datepicker('show'). inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); simulate('keydown', {keyCode: $.ui.keyCode.ENTER});

View File

@ -10,56 +10,56 @@ test('destroy', function() {
var inl, var inl,
inp = init('#inp'); inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set'); 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'); ok(inp.next().is('#alt'), 'Default - button absent');
inp.datepicker('destroy'); inp.datepicker('destroy');
inp = $('#inp'); inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared'); 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'); ok(inp.next().is('#alt'), 'Default - button absent');
// With button // With button
inp= init('#inp', {showOn: 'both'}); inp= init('#inp', {showOn: 'both'});
ok(inp.is('.hasDatepicker'), 'Button - marker class set'); 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'); ok(inp.next().text() === '...', 'Button - button added');
inp.datepicker('destroy'); inp.datepicker('destroy');
inp = $('#inp'); inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared'); 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'); ok(inp.next().is('#alt'), 'Button - button removed');
// With append text // With append text
inp = init('#inp', {appendText: 'Testing'}); inp = init('#inp', {appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Append - marker class set'); 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'); ok(inp.next().text() === 'Testing', 'Append - append text added');
inp.datepicker('destroy'); inp.datepicker('destroy');
inp = $('#inp'); inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared'); 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'); ok(inp.next().is('#alt'), 'Append - append text removed');
// With both // With both
inp= init('#inp', {showOn: 'both', buttonImageOnly: true, inp= init('#inp', {showOn: 'both', buttonImageOnly: true,
buttonImage: 'img/calendar.gif', appendText: 'Testing'}); buttonImage: 'img/calendar.gif', appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Both - marker class set'); 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()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
ok(inp.next().next().text() === 'Testing', 'Both - append text added'); ok(inp.next().next().text() === 'Testing', 'Both - append text added');
inp.datepicker('destroy'); inp.datepicker('destroy');
inp = $('#inp'); inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared'); 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'); ok(inp.next().is('#alt'), 'Both - button and append text absent');
// Inline // Inline
inl = init('#inl'); inl = init('#inl');
ok(inl.is('.hasDatepicker'), 'Inline - marker class set'); ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
ok(inl.html() !== '', 'Inline - datepicker present'); 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'); ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
inl.datepicker('destroy'); inl.datepicker('destroy');
inl = $('#inl'); inl = $('#inl');
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared'); ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
ok(inl.html() === '', 'Inline - datepicker absent'); 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'); ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
}); });

View File

@ -8,7 +8,7 @@ module("datepicker: options");
test('setDefaults', function() { test('setDefaults', function() {
expect( 3 ); expect( 3 );
var inp = init('#inp'); init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn'); equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'}); $.datepicker.setDefaults({showOn: 'button'});
equal($.datepicker._defaults.showOn, 'button', 'Change default showOn'); equal($.datepicker._defaults.showOn, 'button', 'Change default showOn');
@ -19,7 +19,7 @@ test('setDefaults', function() {
test('option', function() { test('option', function() {
expect( 17 ); expect( 17 );
var inp = init('#inp'), var inp = init('#inp'),
inst = $.data(inp[0], PROP_NAME); inst = $.data(inp[0], TestHelpers.PROP_NAME);
// Set option // Set option
equal(inst.settings.showOn, null, 'Initial setting showOn'); equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
@ -51,7 +51,7 @@ test('option', function() {
test('change', function() { test('change', function() {
expect( 12 ); expect( 12 );
var inp = init('#inp'), 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(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
@ -215,12 +215,12 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: ' -1 m '}). inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show'). datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); 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'); equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
inp.datepicker('option', {defaultDate: '+2M'}). inp.datepicker('option', {defaultDate: '+2M'}).
datepicker('hide').val('').datepicker('show'). datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); 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'); equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}). inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show'). datepicker('hide').val('').datepicker('show').
@ -236,7 +236,7 @@ test('defaultDate', function() {
inp.datepicker('option', {defaultDate: '+1M +10d'}). inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show'). datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
date = addMonths(new Date(), 1); date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10); date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d'); equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
// String date values // String date values
@ -380,7 +380,7 @@ test('minMax', function() {
simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date, equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup'); '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); date.setDate(date.getDate() + 10);
inp.val('').datepicker('show'); inp.val('').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
@ -665,16 +665,6 @@ function beforeDay(date) {
(date.getDate() % 3 === 0 ? 'Divisble by 3' : '')]; (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() { test('callbacks', function() {
expect( 13 ); expect( 13 );
// Before show // Before show

View File

@ -8,7 +8,7 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1 // http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() { test('beforeShowDay-getDate', function() {
expect( 3 ); 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'); dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show'); inp.val('01/01/2010').datepicker('show');
// contains non-breaking space // contains non-breaking space

View File

@ -12,13 +12,13 @@ function dlg() {
return el.dialog('widget'); return el.dialog('widget');
} }
function isOpen(why) { TestHelpers.isOpen = function(why) {
ok(dlg().is(":visible"), why); ok(dlg().is(":visible"), why);
} };
function isNotOpen(why) { TestHelpers.isNotOpen = function(why) {
ok(!dlg().is(":visible"), why); ok(!dlg().is(":visible"), why);
} };
function drag(handle, dx, dy) { function drag(handle, dx, dy) {
var d = dlg(); var d = dlg();
@ -38,51 +38,43 @@ function drag(handle, dx, dy) {
widthAfter = d.width(); widthAfter = d.width();
} }
function moved(dx, dy, msg) { TestHelpers.dialogMoved = function(dx, dy, msg) {
msg = msg ? msg + "." : ""; msg = msg ? msg + "." : "";
var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) }, 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) }; expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) };
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
} };
function shouldmove(why) { TestHelpers.shouldmove = function(why) {
var handle = $(".ui-dialog-titlebar", dlg()); var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50); 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()); var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50); 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 + "." : ""; msg = msg ? msg + "." : "";
var actual = { width: widthAfter, height: heightAfter }, var actual = { width: widthAfter, height: heightAfter },
expected = { width: widthBefore + dw, height: heightBefore + dh }; expected = { width: widthBefore + dw, height: heightBefore + dh };
deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
} };
function shouldresize(why) { TestHelpers.shouldresize = function(why) {
var handle = $(".ui-resizable-se", dlg()); var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50); 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()); var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50); drag(handle, 50, 50);
resized(0, 0, why); TestHelpers.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);
}
(function($) { (function($) {

View File

@ -244,7 +244,7 @@ test("beforeClose", function() {
} }
}); });
el.dialog('close'); el.dialog('close');
isOpen('beforeClose callback should prevent dialog from closing'); TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove(); el.remove();
el = $('<div></div>').dialog(); el = $('<div></div>').dialog();
@ -256,7 +256,7 @@ test("beforeClose", function() {
return false; return false;
}); });
el.dialog('close'); el.dialog('close');
isOpen('beforeClose callback should prevent dialog from closing'); TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove(); el.remove();
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) { el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
@ -266,7 +266,7 @@ test("beforeClose", function() {
return false; return false;
}); });
el.dialog('close'); el.dialog('close');
isOpen('dialogbeforeclose event should prevent dialog from closing'); TestHelpers.isOpen('dialogbeforeclose event should prevent dialog from closing');
el.remove(); el.remove();
}); });

View File

@ -25,7 +25,7 @@ test("init", function() {
ok(true, '.dialog() called on disconnected DOMElement - removed'); ok(true, '.dialog() called on disconnected DOMElement - removed');
el = $('<div></div>').dialog(); el = $('<div></div>').dialog();
var foo = el.dialog("option", "foo"); el.dialog("option", "foo");
el.remove(); el.remove();
ok(true, 'arbitrary option getter after init'); ok(true, 'arbitrary option getter after init');

View File

@ -9,11 +9,11 @@ test("autoOpen", function() {
expect(2); expect(2);
el = $('<div></div>').dialog({ autoOpen: false }); el = $('<div></div>').dialog({ autoOpen: false });
isNotOpen('.dialog({ autoOpen: false })'); TestHelpers.isNotOpen('.dialog({ autoOpen: false })');
el.remove(); el.remove();
el = $('<div></div>').dialog({ autoOpen: true }); el = $('<div></div>').dialog({ autoOpen: true });
isOpen('.dialog({ autoOpen: true })'); TestHelpers.isOpen('.dialog({ autoOpen: true })');
el.remove(); el.remove();
}); });
@ -22,12 +22,12 @@ test("buttons", function() {
var btn, i, newButtons, var btn, i, newButtons,
buttons = { buttons = {
"Ok": function(ev, ui) { "Ok": function( ev ) {
ok(true, "button click fires callback"); ok(true, "button click fires callback");
equal(this, el[0], "context of callback"); equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target"); equal(ev.target, btn[0], "event target");
}, },
"Cancel": function(ev, ui) { "Cancel": function( ev ) {
ok(true, "button click fires callback"); ok(true, "button click fires callback");
equal(this, el[0], "context of callback"); equal(this, el[0], "context of callback");
equal(ev.target, btn[1], "event target"); equal(ev.target, btn[1], "event target");
@ -39,7 +39,7 @@ test("buttons", function() {
equal(btn.length, 2, "number of buttons"); equal(btn.length, 2, "number of buttons");
i = 0; i = 0;
$.each(buttons, function(key, val) { $.each(buttons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1)); equal(btn.eq(i).text(), key, "text of button " + (i+1));
i++; i++;
}); });
@ -50,7 +50,7 @@ test("buttons", function() {
btn.trigger("click"); btn.trigger("click");
newButtons = { newButtons = {
"Close": function(ev, ui) { "Close": function( ev ) {
ok(true, "button click fires callback"); ok(true, "button click fires callback");
equal(this, el[0], "context of callback"); equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target"); equal(ev.target, btn[0], "event target");
@ -66,7 +66,7 @@ test("buttons", function() {
btn.trigger('click'); btn.trigger('click');
i = 0; i = 0;
$.each(newButtons, function(key, val) { $.each(newButtons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1)); equal(btn.eq(i).text(), key, "text of button " + (i+1));
i += 1; i += 1;
}); });
@ -166,15 +166,15 @@ test("draggable", function() {
expect(4); expect(4);
el = $('<div></div>').dialog({ draggable: false }); el = $('<div></div>').dialog({ draggable: false });
shouldnotmove(); TestHelpers.shouldnotmove();
el.dialog('option', 'draggable', true); el.dialog('option', 'draggable', true);
shouldmove(); TestHelpers.shouldmove();
el.remove(); el.remove();
el = $('<div></div>').dialog({ draggable: true }); el = $('<div></div>').dialog({ draggable: true });
shouldmove(); TestHelpers.shouldmove();
el.dialog('option', 'draggable', false); el.dialog('option', 'draggable', false);
shouldnotmove(); TestHelpers.shouldnotmove();
el.remove(); el.remove();
}); });
@ -395,15 +395,15 @@ test("resizable", function() {
expect(4); expect(4);
el = $('<div></div>').dialog(); el = $('<div></div>').dialog();
shouldresize("[default]"); TestHelpers.shouldresize("[default]");
el.dialog('option', 'resizable', false); el.dialog('option', 'resizable', false);
shouldnotresize('disabled after init'); TestHelpers.shouldnotresize('disabled after init');
el.remove(); el.remove();
el = $('<div></div>').dialog({ resizable: false }); el = $('<div></div>').dialog({ resizable: false });
shouldnotresize("disabled in init options"); TestHelpers.shouldnotresize("disabled in init options");
el.dialog('option', 'resizable', true); el.dialog('option', 'resizable', true);
shouldresize('enabled after init'); TestHelpers.shouldresize('enabled after init');
el.remove(); el.remove();
}); });

View File

@ -39,18 +39,18 @@ test("#4826: setting resizable false toggles resizable on dialog", function() {
var i; var i;
el = $('<div></div>').dialog({ resizable: false }); el = $('<div></div>').dialog({ resizable: false });
shouldnotresize("[default]"); TestHelpers.shouldnotresize("[default]");
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
el.dialog('close').dialog('open'); 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.remove();
el = $('<div></div>').dialog({ resizable: true }); el = $('<div></div>').dialog({ resizable: true });
shouldresize("[default]"); TestHelpers.shouldresize("[default]");
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
el.dialog('close').dialog('option', 'resizable', false).dialog('open'); 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(); el.remove();

View File

@ -5,7 +5,6 @@
var el, offsetBefore, offsetAfter, dragged; var el, offsetBefore, offsetAfter, dragged;
function drag(handle, dx, dy) { function drag(handle, dx, dy) {
var element = el.data("draggable").element;
offsetBefore = el.offset(); offsetBefore = el.offset();
$(handle).simulate("drag", { $(handle).simulate("drag", {
dx: dx || 0, dx: dx || 0,
@ -22,8 +21,8 @@ function moved(dx, dy, msg) {
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
} }
function restoreScroll(what) { TestHelpers.restoreScroll = function( what ) {
if(what) { if( what ) {
$(document).scrollTop(0); $(document).scrollLeft(0); $(document).scrollTop(0); $(document).scrollLeft(0);
} else { } else {
$("#main")[0].scrollTop = 0; $("#main")[0].scrollLeft = 0; $("#main")[0].scrollTop = 0; $("#main")[0].scrollLeft = 0;

View File

@ -210,7 +210,7 @@ test("{ cursor: 'auto' }, default", function() {
el = $("#draggable2").draggable({ el = $("#draggable2").draggable({
cursor: expected, cursor: expected,
start: function(event, ui) { start: function() {
actual = getCursor(); actual = getCursor();
} }
}); });
@ -234,7 +234,7 @@ test("{ cursor: 'move' }", function() {
el = $("#draggable2").draggable({ el = $("#draggable2").draggable({
cursor: expected, cursor: expected,
start: function(event, ui) { start: function() {
actual = getCursor(); actual = getCursor();
} }
}); });
@ -449,7 +449,7 @@ test("{ helper: 'original' }, relative, with scroll offset on parent", function(
setScroll(); setScroll();
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
}); });
@ -466,7 +466,7 @@ test("{ helper: 'original' }, relative, with scroll offset on root", function()
setScroll('root'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
@ -486,8 +486,8 @@ test("{ helper: 'original' }, relative, with scroll offset on root and parent",
setScroll('root'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
@ -504,7 +504,7 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function(
setScroll(); setScroll();
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
}); });
@ -521,7 +521,7 @@ test("{ helper: 'original' }, absolute, with scroll offset on root", function()
setScroll('root'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
@ -541,8 +541,8 @@ test("{ helper: 'original' }, absolute, with scroll offset on root and parent",
setScroll('root'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
@ -559,7 +559,7 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() {
setScroll(); setScroll();
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
}); });
@ -576,7 +576,7 @@ test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
setScroll('root'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() { 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'); setScroll('root');
testScroll('absolute'); testScroll('absolute');
restoreScroll(); TestHelpers.restoreScroll();
restoreScroll('root'); TestHelpers.restoreScroll('root');
}); });
@ -639,7 +639,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
drag(el, 1, 1); drag(el, 1, 1);
deepEqual({ 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(); TestHelpers.restoreScroll();
}); });
@ -668,7 +668,7 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
drag(el, 1, 1); drag(el, 1, 1);
deepEqual({ 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'); TestHelpers.restoreScroll('root');
}); });
@ -698,8 +698,8 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
drag(el, 1, 1); drag(el, 1, 1);
deepEqual({ 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'); TestHelpers.restoreScroll('root');
restoreScroll(); TestHelpers.restoreScroll();
}); });
@ -710,7 +710,7 @@ test("{ opacity: 0.5 }", function() {
var opacity = null; var opacity = null;
el = $("#draggable2").draggable({ el = $("#draggable2").draggable({
opacity: 0.5, opacity: 0.5,
start: function(event, ui) { start: function() {
opacity = $(this).css("opacity"); opacity = $(this).css("opacity");
} }
}); });
@ -726,11 +726,11 @@ test("{ zIndex: 10 }", function() {
expect(1); expect(1);
var actual, var actual,
expected = 10, expected = 10;
zIndex = null;
el = $("#draggable2").draggable({ el = $("#draggable2").draggable({
zIndex: expected, zIndex: expected,
start: function(event, ui) { start: function() {
actual = $(this).css("zIndex"); actual = $(this).css("zIndex");
} }
}); });

View File

@ -2,15 +2,15 @@
* droppable_core.js * droppable_core.js
*/ */
var el, drg; var el;
function shouldBeDroppable() { TestHelpers.shouldBeDroppable = function() {
ok(false, 'missing test - untested code is broken code'); ok(false, 'missing test - untested code is broken code');
} };
function shouldNotBeDroppable() { TestHelpers.shouldNotBeDroppable = function() {
ok(false, 'missing test - untested code is broken code'); ok(false, 'missing test - untested code is broken code');
} };
(function($) { (function($) {
@ -27,7 +27,7 @@ test("element types", function() {
el = $(document.createElement(typeName)).appendTo('body'); el = $(document.createElement(typeName)).appendTo('body');
(typeName === 'table' && el.append("<tr><td>content</td></tr>")); (typeName === 'table' && el.append("<tr><td>content</td></tr>"));
el.droppable(); el.droppable();
shouldBeDroppable(); TestHelpers.shouldBeDroppable();
el.droppable("destroy"); el.droppable("destroy");
el.remove(); el.remove();
}); });

View File

@ -5,6 +5,10 @@
module("droppable: events"); 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() { test("activate", function() {
ok(false, 'missing test - untested code is broken code'); ok(false, 'missing test - untested code is broken code');
}); });

View File

@ -48,16 +48,16 @@ test("destroy", function() {
test("enable", function() { test("enable", function() {
expect(7); expect(7);
el = $("#droppable1").droppable({ disabled: true }); el = $("#droppable1").droppable({ disabled: true });
shouldNotBeDroppable(); TestHelpers.shouldNotBeDroppable();
el.droppable("enable"); el.droppable("enable");
shouldBeDroppable(); TestHelpers.shouldBeDroppable();
equal(el.droppable("option", "disabled"), false, "disabled option getter"); equal(el.droppable("option", "disabled"), false, "disabled option getter");
el.droppable("destroy"); el.droppable("destroy");
el.droppable({ disabled: true }); el.droppable({ disabled: true });
shouldNotBeDroppable(); TestHelpers.shouldNotBeDroppable();
el.droppable("option", "disabled", false); el.droppable("option", "disabled", false);
equal(el.droppable("option", "disabled"), false, "disabled option setter"); equal(el.droppable("option", "disabled"), false, "disabled option setter");
shouldBeDroppable(); TestHelpers.shouldBeDroppable();
var expected = $('<div></div>').droppable(), var expected = $('<div></div>').droppable(),
actual = expected.droppable('enable'); actual = expected.droppable('enable');
@ -67,16 +67,16 @@ test("enable", function() {
test("disable", function() { test("disable", function() {
expect(7); expect(7);
el = $("#droppable1").droppable({ disabled: false }); el = $("#droppable1").droppable({ disabled: false });
shouldBeDroppable(); TestHelpers.shouldBeDroppable();
el.droppable("disable"); el.droppable("disable");
shouldNotBeDroppable(); TestHelpers.shouldNotBeDroppable();
equal(el.droppable("option", "disabled"), true, "disabled option getter"); equal(el.droppable("option", "disabled"), true, "disabled option getter");
el.droppable("destroy"); el.droppable("destroy");
el.droppable({ disabled: false }); el.droppable({ disabled: false });
shouldBeDroppable(); TestHelpers.shouldBeDroppable();
el.droppable("option", "disabled", true); el.droppable("option", "disabled", true);
equal(el.droppable("option", "disabled"), true, "disabled option setter"); equal(el.droppable("option", "disabled"), true, "disabled option setter");
shouldNotBeDroppable(); TestHelpers.shouldNotBeDroppable();
var expected = $('<div></div>').droppable(), var expected = $('<div></div>').droppable(),
actual = expected.droppable('disable'); actual = expected.droppable('disable');

View File

@ -12,10 +12,7 @@ function notPresent( value, array, message ) {
var minDuration = 15, var minDuration = 15,
// duration is used for "long" animates where we plan on testing properties during animation // duration is used for "long" animates where we plan on testing properties during animation
duration = 200, duration = 200;
// mid is used for testing in the "middle" of the "duration" animations
mid = duration / 2;
module( "effects.core" ); module( "effects.core" );
@ -58,8 +55,7 @@ test( "createWrapper and removeWrapper retain focused elements (#7595)", functio
module( "effects.core: animateClass" ); module( "effects.core: animateClass" );
asyncTest( "animateClass works with borderStyle", function() { asyncTest( "animateClass works with borderStyle", function() {
var test = $("div.animateClass"), var test = $("div.animateClass");
count = 0;
expect(3); expect(3);
test.toggleClass("testAddBorder", minDuration, function() { test.toggleClass("testAddBorder", minDuration, function() {
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() { asyncTest( "animateClass works with colors", function() {
var test = $("div.animateClass"), var test = $("div.animateClass"),
count = 0,
oldStep = jQuery.fx.step.backgroundColor; oldStep = jQuery.fx.step.backgroundColor;
expect(2); expect(2);
// we want to catch the first frame of animation // 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() { asyncTest( "animateClass calls step option", 1, function() {
var test = jQuery( "div.animateClass" ), var test = jQuery( "div.animateClass" ),
step = function( fx ) { step = function() {
ok( true, "Step Function Called" ); ok( true, "Step Function Called" );
test.stop(); test.stop();
start(); start();
@ -216,7 +212,7 @@ $.each( $.effects.effect, function( effect ) {
equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" ); equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
})).queue( queueTest() ).hide( effect, minDuration, queueTest(function() { })).queue( queueTest() ).hide( effect, minDuration, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" ); 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"); deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
start(); start();
})); }));

View File

@ -13,7 +13,7 @@ module( "menu: events", {
test( "handle click on menu", function() { test( "handle click on menu", function() {
expect( 1 ); expect( 1 );
var element = $( "#menu1" ).menu({ var element = $( "#menu1" ).menu({
select: function( event, ui ) { select: function() {
log(); log();
} }
}); });
@ -29,7 +29,7 @@ test( "handle click on menu", function() {
test( "handle click on custom item menu", function() { test( "handle click on custom item menu", function() {
expect( 1 ); expect( 1 );
var element = $( "#menu5" ).menu({ var element = $( "#menu5" ).menu({
select: function( event, ui ) { select: function() {
log(); log();
}, },
menus: "div" menus: "div"
@ -47,7 +47,7 @@ asyncTest( "handle blur", function() {
expect( 1 ); expect( 1 );
var blurHandled = false, var blurHandled = false,
element = $( "#menu1" ).menu({ element = $( "#menu1" ).menu({
blur: function( event, ui ) { blur: function( event ) {
// Ignore duplicate blur event fired by IE // Ignore duplicate blur event fired by IE
if ( !blurHandled ) { if ( !blurHandled ) {
blurHandled = true; blurHandled = true;
@ -69,7 +69,7 @@ asyncTest( "handle blur via click outside", function() {
expect( 1 ); expect( 1 );
var blurHandled = false, var blurHandled = false,
element = $( "#menu1" ).menu({ element = $( "#menu1" ).menu({
blur: function( event, ui ) { blur: function( event ) {
// Ignore duplicate blur event fired by IE // Ignore duplicate blur event fired by IE
if ( !blurHandled ) { if ( !blurHandled ) {
blurHandled = true; blurHandled = true;
@ -90,7 +90,7 @@ asyncTest( "handle blur via click outside", function() {
test( "handle focus of menu with active item", function() { test( "handle focus of menu with active item", function() {
expect( 1 ); expect( 1 );
var element = $( "#menu1" ).menu({ var element = $( "#menu1" ).menu({
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); 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 ) { select: function( event, ui ) {
log( $( ui.item[0] ).text() ); log( $( ui.item[0] ).text() );
}, },
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); 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 ) { select: function( event, ui ) {
log( $( ui.item[0] ).text() ); log( $( ui.item[0] ).text() );
}, },
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
} }
}); });
log( "keydown", true ); 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 } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown 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 ) { select: function( event, ui ) {
log( $( ui.item[0] ).text() ); log( $( ui.item[0] ).text() );
}, },
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index()); 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 ) { select: function( event, ui ) {
log( $( ui.item[0] ).text() ); log( $( ui.item[0] ).text() );
}, },
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index()); log( $( event.target ).find( ".ui-state-focus" ).parent().index());
} }
}); });
log( "keydown", true ); 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 } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown 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 ) { select: function( event, ui ) {
log( $( ui.item[0] ).text() ); log( $( ui.item[0] ).text() );
}, },
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index()); log( $( event.target ).find( ".ui-state-focus" ).parent().index());
} }
}); });
log( "keydown", true ); 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 } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( logOutput(), "keydown,1", "Keydown focus but not select disabled item" ); 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() { test( "handle keyboard navigation with spelling of menu items", function() {
expect( 2 ); expect( 2 );
var element = $( "#menu2" ).menu({ var element = $( "#menu2" ).menu({
focus: function( event, ui ) { focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
} }
}); });
log( "keydown", true ); log( "keydown", true );
element.one( "menufocus", function( event, ui ) { element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: 65 } ); element.simulate( "keydown", { keyCode: 65 } );
element.simulate( "keydown", { keyCode: 68 } ); element.simulate( "keydown", { keyCode: 68 } );
element.simulate( "keydown", { keyCode: 68 } ); element.simulate( "keydown", { keyCode: 68 } );

View File

@ -29,7 +29,7 @@ test( "destroy", function() {
test( "enable/disable", function() { test( "enable/disable", function() {
expect( 3 ); expect( 3 );
var element = $( "#menu1" ).menu({ var element = $( "#menu1" ).menu({
select: function( event, ui ) { select: function() {
log(); log();
} }
}); });

View File

@ -14,7 +14,7 @@ test( "{ disabled: true }", function() {
expect( 2 ); expect( 2 );
var element = $( "#menu1" ).menu({ var element = $( "#menu1" ).menu({
disabled: true, disabled: true,
select: function(event, ui) { select: function() {
log(); log();
} }
}); });
@ -29,7 +29,7 @@ test( "{ disabled: false }", function() {
expect( 2 ); expect( 2 );
var element = $( "#menu1" ).menu({ var element = $( "#menu1" ).menu({
disabled: false, disabled: false,
select: function( event, ui ) { select: function() {
log(); log();
} }
}); });

View File

@ -2,9 +2,7 @@
* resizable_core.js * resizable_core.js
*/ */
var el; TestHelpers.resizableDrag = function(el, dx, dy, complete) {
var drag = function(el, dx, dy, complete) {
// speed = sync -> Drag syncrhonously. // speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated. // speed = fast|slow -> Drag asyncrhonously - animated.
@ -46,10 +44,10 @@ test("n", function() {
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' }); 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" ); equal( target.height(), 150, "compare height" );
drag(handle, 0, 50); TestHelpers.resizableDrag(handle, 0, 50);
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });
@ -58,10 +56,10 @@ test("s", function() {
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' }); 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" ); equal( target.height(), 150, "compare height" );
drag(handle, 0, -50); TestHelpers.resizableDrag(handle, 0, -50);
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });
@ -70,10 +68,10 @@ test("e", function() {
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' }); var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, 50); TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 150, "compare width"); equal( target.width(), 150, "compare width");
drag(handle, -50); TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
}); });
@ -82,10 +80,10 @@ test("w", function() {
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' }); var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, -50); TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 150, "compare width" ); equal( target.width(), 150, "compare width" );
drag(handle, 50); TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 100, "compare width" ); 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' }); 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.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" ); equal( target.height(), 150, "compare height" );
drag(handle, 50, 50); TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });
@ -108,11 +106,11 @@ test("se", function() {
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' }); 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.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" ); equal( target.height(), 150, "compare height" );
drag(handle, -50, -50); TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });
@ -122,11 +120,11 @@ test("sw", function() {
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' }); 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.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" ); equal( target.height(), 50, "compare height" );
drag(handle, 50, 50); TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });
@ -136,11 +134,11 @@ test("nw", function() {
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' }); 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.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" ); equal( target.height(), 150, "compare height" );
drag(handle, 50, 50); TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" ); equal( target.height(), 100, "compare height" );
}); });

View File

@ -5,4 +5,8 @@
module("resizable: events"); 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); })(jQuery);

View File

@ -5,5 +5,8 @@
module("resizable: methods"); 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); })(jQuery);

View File

@ -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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, -130); TestHelpers.resizableDrag(handle, -130);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, 130); TestHelpers.resizableDrag(handle, 130);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, 0, 80); TestHelpers.resizableDrag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, 0, -80); TestHelpers.resizableDrag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, -80, -80); TestHelpers.resizableDrag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, 80, -80); TestHelpers.resizableDrag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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 }); 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.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight"); equal( target.height(), 130, "compare maxHeight");
drag(handle, -80, 80); TestHelpers.resizableDrag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth"); equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight"); 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] }); 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.width(), 103, "compare width");
equal( target.height(), 100, "compare height"); equal( target.height(), 100, "compare height");
drag(handle, 15, 11); TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width"); equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height"); 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] }); 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.width(), 103, "compare width");
equal( target.height(), 100, "compare height"); equal( target.height(), 100, "compare height");
drag(handle, 15, 11); TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width"); equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height"); 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 }); 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.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" ); equal( target.height(), 60, "compare minHeight" );
drag(handle, 70, 70); TestHelpers.resizableDrag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" ); equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" ); 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 }); 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.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" ); equal( target.height(), 60, "compare minHeight" );
drag(handle, -70, 70); TestHelpers.resizableDrag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" ); equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" ); 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 }); 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.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" ); equal( target.height(), 60, "compare minHeight" );
drag(handle, 70, -70); TestHelpers.resizableDrag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" ); equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" ); 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 }); 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.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" ); equal( target.height(), 60, "compare minHeight" );
drag(handle, -70, -70); TestHelpers.resizableDrag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" ); equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" ); equal( target.height(), 100, "compare maxHeight" );
}); });

View File

@ -4,7 +4,7 @@
var el; var el;
var drag = function(dx, dy) { TestHelpers.selectableDrag = function drag(dx, dy) {
var off = el.offset(), pos = { clientX: off.left, clientY: off.top }; var off = el.offset(), pos = { clientX: off.left, clientY: off.top };
el.simulate("mousedown", pos); el.simulate("mousedown", pos);
$(document).simulate("mousemove", pos); $(document).simulate("mousemove", pos);

View File

@ -9,7 +9,7 @@ test("start", function() {
expect(2); expect(2);
el = $("#selectable1"); el = $("#selectable1");
el.selectable({ el.selectable({
start: function(ev, ui) { start: function() {
ok(true, "drag fired start callback"); ok(true, "drag fired start callback");
equal(this, el[0], "context of callback"); equal(this, el[0], "context of callback");
} }
@ -21,7 +21,7 @@ test("stop", function() {
expect(2); expect(2);
el = $("#selectable1"); el = $("#selectable1");
el.selectable({ el.selectable({
start: function(ev, ui) { start: function() {
ok(true, "drag fired stop callback"); ok(true, "drag fired stop callback");
equal(this, el[0], "context of callback"); equal(this, el[0], "context of callback");
} }

View File

@ -21,7 +21,7 @@ test("init", function() {
ok(true, 'arbitrary method called after init'); ok(true, 'arbitrary method called after init');
el = $("<div></div>").selectable(); el = $("<div></div>").selectable();
var foo = el.selectable("option", "foo"); el.selectable("option", "foo");
el.remove(); el.remove();
ok(true, 'arbitrary option getter after init'); ok(true, 'arbitrary option getter after init');

View File

@ -13,7 +13,7 @@ test("autoRefresh", function() {
actual = 0; actual = 0;
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected }); el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
sel.hide(); sel.hide();
drag(1000, 1000); TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length); equal(actual, sel.length);
el.selectable("destroy"); el.selectable("destroy");
@ -21,10 +21,10 @@ test("autoRefresh", function() {
sel.show(); sel.show();
el = $("#selectable1").selectable({ autoRefresh: true, selected: selected }); el = $("#selectable1").selectable({ autoRefresh: true, selected: selected });
sel.hide(); sel.hide();
drag(1000, 1000); TestHelpers.selectableDrag(1000, 1000);
equal(actual, 0); equal(actual, 0);
sel.show(); sel.show();
drag(1000, 1000); TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length); equal(actual, sel.length);
el.selectable("destroy"); el.selectable("destroy");
sel.show(); sel.show();
@ -37,7 +37,7 @@ test("filter", function() {
actual = 0; actual = 0;
el = $("#selectable1").selectable({ filter: '.special', selected: selected }); 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"); ok(sel.length !== 1, "this test assumes more than 1 selectee");
equal(actual, 1); equal(actual, 1);
el.selectable("destroy"); el.selectable("destroy");

View File

@ -14,16 +14,16 @@ test( "mouse based interaction", function() {
var el = $( "#slider1" ) var el = $( "#slider1" )
.slider({ .slider({
start: function(event, ui) { start: function( event ) {
equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); 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" ); 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" ); 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" ); 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) // Test keyup at end of handle slide (keyboard)
var el = $( "#slider1" ) var el = $( "#slider1" )
.slider({ .slider({
start: function(event, ui) { start: function( event ) {
equal( event.originalEvent.type, "keydown", "start triggered by keydown" ); equal( event.originalEvent.type, "keydown", "start triggered by keydown" );
}, },
slide: function(event, ui) { slide: function() {
ok( false, "Slider never triggered by keys" ); ok( false, "Slider never triggered by keys" );
}, },
stop: function(event, ui) { stop: function( event ) {
equal( event.originalEvent.type, "keyup", "stop triggered by keyup" ); 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" ); equal( event.originalEvent.type, "keyup", "change triggered by keyup" );
} }
}); });
@ -64,7 +64,7 @@ test( "programmatic event triggers", function() {
// Test value method // Test value method
var el = $( "<div></div>" ) var el = $( "<div></div>" )
.slider({ .slider({
change: function(event, ui) { change: function() {
ok( true, "change triggered by value method" ); ok( true, "change triggered by value method" );
} }
}) })
@ -75,7 +75,7 @@ test( "programmatic event triggers", function() {
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
values: [ 10, 20 ], values: [ 10, 20 ],
change: function(event, ui) { change: function() {
ok( true, "change triggered by values method" ); ok( true, "change triggered by values method" );
} }
}) })
@ -85,7 +85,7 @@ test( "programmatic event triggers", function() {
// Test value option // Test value option
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
change: function(event, ui) { change: function() {
ok( true, "change triggered by value option" ); ok( true, "change triggered by value option" );
} }
}) })
@ -96,7 +96,7 @@ test( "programmatic event triggers", function() {
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
values: [ 10, 20 ], values: [ 10, 20 ],
change: function(event, ui) { change: function() {
ok( true, "change triggered by values option" ); ok( true, "change triggered by values option" );
} }
}) })

View File

@ -17,8 +17,8 @@ test("init", function() {
$('<div></div>').slider().remove(); $('<div></div>').slider().remove();
ok(true, '.slider() called on disconnected DOMElement'); ok(true, '.slider() called on disconnected DOMElement');
var el = $('<div></div>').slider(), var el = $('<div></div>').slider();
foo = el.slider("option", "foo"); el.slider("option", "foo");
el.remove(); el.remove();
ok(true, 'arbitrary option getter after init'); ok(true, 'arbitrary option getter after init');

View File

@ -6,4 +6,8 @@
module("sortable: core"); 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); })(jQuery);

View File

@ -5,6 +5,10 @@
module("sortable: options"); 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() { test("{ appendTo: 'parent' }, default", function() {
ok(false, "missing test - untested code is broken code."); ok(false, "missing test - untested code is broken code.");
}); });

View File

@ -44,13 +44,13 @@ test('#4752: link event firing on sortable with connect list', function () {
$('#main ul').sortable({ $('#main ul').sortable({
connectWith: '#main ul', connectWith: '#main ul',
change: function (e, ui) { change: function () {
fired.change = true; fired.change = true;
}, },
receive: function (e, ui) { receive: function () {
fired.receive = true; fired.receive = true;
}, },
remove: function (e, ui) { remove: function () {
fired.remove = true; fired.remove = true;
} }
}); });

View File

@ -1,7 +1,5 @@
(function( $ ) { (function( $ ) {
var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
module( "spinner: options" ); module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat // culture is tested after numberFormat, since it depends on numberFormat
@ -28,7 +26,7 @@ test( "icons: custom ", function() {
test( "incremental, false", function() { test( "incremental, false", function() {
expect( 100 ); expect( 100 );
var i, diff, var i,
prev = 0, prev = 0,
element = $( "#spin" ).val( prev ).spinner({ element = $( "#spin" ).val( prev ).spinner({
incremental: false, incremental: false,
@ -53,7 +51,7 @@ test( "incremental, true", function() {
}); });
} }
var i, diff, var i,
prev = 0, prev = 0,
expected = [].concat( fill( 18, 1 ), fill( 37, 2 ), fill( 14, 3 ), expected = [].concat( fill( 18, 1 ), fill( 37, 2 ), fill( 14, 3 ),
fill( 9, 4 ), fill( 6, 5 ), fill( 5, 6 ), fill ( 5, 7 ), fill( 9, 4 ), fill( 6, 5 ), fill( 5, 6 ), fill ( 5, 7 ),

View File

@ -132,7 +132,6 @@ test( "accessibility", function() {
asyncTest( "accessibility - ajax", function() { asyncTest( "accessibility - ajax", function() {
expect( 4 ); expect( 4 );
var element = $( "#tabs2" ).tabs(), var element = $( "#tabs2" ).tabs(),
tab = element.find( ".ui-tabs-nav li" ).eq( 3 ),
panel = $( "#custom-id" ); panel = $( "#custom-id" );
equal( panel.attr( "aria-live" ), "polite", "remote panel has aria-live" ); 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() { test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
expect( 1 ); expect( 1 );
var element = $( "#tabs2" ).tabs({ $( "#tabs2" ).tabs({
active: 2, active: 2,
beforeLoad: function( event, ui ) { beforeLoad: function( event, ui ) {
event.preventDefault(); 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>" ); var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
element.appendTo( "#main" ); element.appendTo( "#main" );
element.tabs({ element.tabs({
beforeLoad: function( event, ui ) { beforeLoad: function() {
event.preventDefault(); event.preventDefault();
ok( false, "should not be an ajax tab" ); ok( false, "should not be an ajax tab" );
} }

View File

@ -53,20 +53,20 @@ asyncTest( "cache", function() {
var element = $( "#tabs2" ).tabs({ var element = $( "#tabs2" ).tabs({
cache: true cache: true
}); });
element.one( "tabsshow", function( event, ui ) { element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 ); state( element, 0, 0, 1, 0, 0 );
}); });
element.one( "tabsload", function( event, ui ) { element.one( "tabsload", function() {
ok( true, "tabsload" ); ok( true, "tabsload" );
setTimeout(function() { setTimeout(function() {
element.tabs( "option", "active", 0 ); element.tabs( "option", "active", 0 );
state( element, 1, 0, 0, 0, 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 ); state( element, 0, 0, 1, 0, 0 );
}); });
element.one( "tabsload", function( event, ui ) { element.one( "tabsload", function() {
ok( false, "should be cached" ); ok( false, "should be cached" );
}); });
element.tabs( "option", "active", 2 ); element.tabs( "option", "active", 2 );
@ -159,10 +159,10 @@ asyncTest( "spinner", function() {
var element = $( "#tabs2" ).tabs(); 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" ); 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 // wait until after the load finishes before checking for the spinner to be removed
setTimeout(function() { setTimeout(function() {
equal( 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" );
@ -351,7 +351,7 @@ test( "show", function() {
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
// collapsing // collapsing
element.one( "tabsshow", function( event, ui ) { element.one( "tabsshow", function() {
ok( false, "collapsing" ); ok( false, "collapsing" );
}); });
element.tabs( "option", "active", false ); element.tabs( "option", "active", false );
@ -391,7 +391,7 @@ test( "select", function() {
state( element, 0, 1, 0 ); state( element, 0, 1, 0 );
// collapsing // collapsing
element.one( "tabsselect", function( event, ui ) { element.one( "tabsselect", function() {
ok( false, "collapsing" ); ok( false, "collapsing" );
}); });
element.tabs( "option", "active", false ); element.tabs( "option", "active", false );

View File

@ -116,7 +116,7 @@ function testWidgetDefaults( widget, defaults ) {
// ensure that all defaults were tested // ensure that all defaults were tested
test( "tested defaults", function() { test( "tested defaults", function() {
var count = 0; var count = 0;
$.each( pluginDefaults, function( key, val ) { $.each( pluginDefaults, function( key ) {
expect( ++count ); expect( ++count );
ok( key in defaults, key ); ok( key in defaults, key );
}); });
@ -227,7 +227,7 @@ window.domEqual = function( selector, modifier, message ) {
delete result.data[ $.expando ]; delete result.data[ $.expando ];
children = elem.children(); children = elem.children();
if ( children.length ) { if ( children.length ) {
result.children = elem.children().map(function( ind ) { result.children = elem.children().map(function() {
return extract( $( this ) ); return extract( $( this ) );
}).get(); }).get();
} else { } else {

View File

@ -67,7 +67,7 @@ test( "content: change while open", function() {
test( "content: string", function() { test( "content: string", function() {
expect( 1 ); expect( 1 );
var element = $( "#tooltipped1" ).tooltip({ $( "#tooltipped1" ).tooltip({
content: "just a string", content: "just a string",
open: function( event, ui ) { open: function( event, ui ) {
equal( ui.tooltip.text(), "just a string" ); equal( ui.tooltip.text(), "just a string" );

View File

@ -313,7 +313,7 @@ test( "re-init", function() {
_init: function() { _init: function() {
actions.push( "init" ); actions.push( "init" );
}, },
_setOption: function( key, value ) { _setOption: function( key ) {
actions.push( "option" + key ); actions.push( "option" + key );
} }
}); });
@ -959,11 +959,11 @@ test( "._trigger() - cancelled event", function() {
}); });
$( "#widget" ).testWidget({ $( "#widget" ).testWidget({
foo: function( event, ui ) { foo: function() {
ok( true, "callback invoked even if event is cancelled" ); ok( true, "callback invoked even if event is cancelled" );
} }
}) })
.bind( "testwidgetfoo", function( event, ui ) { .bind( "testwidgetfoo", function() {
ok( true, "event was triggered" ); ok( true, "event was triggered" );
return false; return false;
}); });
@ -978,7 +978,7 @@ test( "._trigger() - cancelled callback", function() {
}); });
$( "#widget" ).testWidget({ $( "#widget" ).testWidget({
foo: function( event, ui ) { foo: function() {
return false; return false;
} }
}); });

View File

@ -10,6 +10,7 @@
"onevar": true, "onevar": true,
"trailing": true, "trailing": true,
"undef": true, "undef": true,
"unused": true,
"predef": [ "predef": [
"Globalize" "Globalize"
] ]

View File

@ -603,7 +603,7 @@ if ( $.uiBackCompat !== false ) {
_create.call( this ); _create.call( this );
}, },
_setOption: function( key, value ) { _setOption: function( key ) {
if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) { if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
this.options.heightStyle = this._mergeHeightStyle(); this.options.heightStyle = this._mergeHeightStyle();
} }

View File

@ -359,7 +359,7 @@ $.widget( "ui.autocomplete", {
url: url, url: url,
data: request, data: request,
dataType: "json", dataType: "json",
success: function( data, status ) { success: function( data ) {
response( data ); response( data );
}, },
error: function() { error: function() {
@ -541,7 +541,7 @@ $.widget( "ui.autocomplete", {
return this.menu.element; return this.menu.element;
}, },
_value: function( value ) { _value: function() {
return this.valueMethod.apply( this.element, arguments ); return this.valueMethod.apply( this.element, arguments );
}, },

View File

@ -88,6 +88,11 @@ $.widget("ui.dialog", {
options = this.options, options = this.options,
title = options.title || "&#160;", title = options.title || "&#160;",
uiDialog,
uiDialogTitlebar,
uiDialogTitlebarClose,
uiDialogTitle,
uiDialogButtonPane;
uiDialog = ( this.uiDialog = $( "<div>" ) ) uiDialog = ( this.uiDialog = $( "<div>" ) )
.addClass( uiDialogClasses + options.dialogClass ) .addClass( uiDialogClasses + options.dialogClass )
@ -108,13 +113,13 @@ $.widget("ui.dialog", {
.mousedown(function( event ) { .mousedown(function( event ) {
that.moveToTop( false, event ); that.moveToTop( false, event );
}) })
.appendTo( "body" ), .appendTo( "body" );
uiDialogContent = this.element this.element
.show() .show()
.removeAttr( "title" ) .removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" ) .addClass( "ui-dialog-content ui-widget-content" )
.appendTo( uiDialog ), .appendTo( uiDialog );
uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) ) uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
.addClass( "ui-dialog-titlebar ui-widget-header " + .addClass( "ui-dialog-titlebar ui-widget-header " +
@ -123,7 +128,7 @@ $.widget("ui.dialog", {
// Dialog isn't getting focus when dragging (#8063) // Dialog isn't getting focus when dragging (#8063)
uiDialog.focus(); uiDialog.focus();
}) })
.prependTo( uiDialog ), .prependTo( uiDialog );
uiDialogTitlebarClose = $( "<a href='#'></a>" ) uiDialogTitlebarClose = $( "<a href='#'></a>" )
.addClass( "ui-dialog-titlebar-close ui-corner-all" ) .addClass( "ui-dialog-titlebar-close ui-corner-all" )
@ -132,23 +137,23 @@ $.widget("ui.dialog", {
event.preventDefault(); event.preventDefault();
that.close( event ); that.close( event );
}) })
.appendTo( uiDialogTitlebar ), .appendTo( uiDialogTitlebar );
uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) ) ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
.addClass( "ui-icon ui-icon-closethick" ) .addClass( "ui-icon ui-icon-closethick" )
.text( options.closeText ) .text( options.closeText )
.appendTo( uiDialogTitlebarClose ), .appendTo( uiDialogTitlebarClose );
uiDialogTitle = $( "<span>" ) uiDialogTitle = $( "<span>" )
.uniqueId() .uniqueId()
.addClass( "ui-dialog-title" ) .addClass( "ui-dialog-title" )
.html( title ) .html( title )
.prependTo( uiDialogTitlebar ), .prependTo( uiDialogTitlebar );
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) ) 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" ) .addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane ); .appendTo( uiDialogButtonPane );
@ -350,8 +355,7 @@ $.widget("ui.dialog", {
}, },
_createButtons: function( buttons ) { _createButtons: function( buttons ) {
var uiDialogButtonPane, uiButtonSet, var that = this,
that = this,
hasButtons = false; hasButtons = false;
// if we already have a button pane, remove it // if we already have a button pane, remove it

View File

@ -245,8 +245,7 @@ color.fn = jQuery.extend( color.prototype, {
var inst = this, var inst = this,
type = jQuery.type( red ), type = jQuery.type( red ),
rgba = this._rgba = [], rgba = this._rgba = [];
source;
// more than 1 argument specified - assume ( red, green, blue, alpha ) // more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) { if ( green !== undefined ) {
@ -427,7 +426,7 @@ color.fn = jQuery.extend( color.prototype, {
rgba.push( ~~( alpha * 255 ) ); rgba.push( ~~( alpha * 255 ) );
} }
return "#" + jQuery.map( rgba, function( v, i ) { return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist // default to 0 when nulls exist
v = ( v || 0 ).toString( 16 ); v = ( v || 0 ).toString( 16 );
@ -501,8 +500,7 @@ spaces.hsla.from = function ( hsla ) {
l = hsla[ 2 ], l = hsla[ 2 ],
a = hsla[ 3 ], a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
p = 2 * l - q, p = 2 * l - q;
r, g, b;
return [ return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
@ -710,7 +708,6 @@ function getElementStyles() {
this.currentStyle, this.currentStyle,
newStyle = {}, newStyle = {},
key, key,
camelCase,
len; len;
// webkit enumerates style porperties // webkit enumerates style porperties
@ -1114,7 +1111,7 @@ function standardSpeed( speed ) {
} }
$.fn.extend({ $.fn.extend({
effect: function( effect, options, speed, callback ) { effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ), var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode, mode = args.mode,
queue = args.queue, queue = args.queue,

View File

@ -278,7 +278,7 @@ $.widget( "ui.slider", $.ui.mouse, {
return true; return true;
}, },
_mouseStart: function( event ) { _mouseStart: function() {
return true; return true;
}, },
@ -591,7 +591,7 @@ $.widget( "ui.slider", $.ui.mouse, {
_set = {}; _set = {};
if ( this.options.values && this.options.values.length ) { 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; valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );

12
ui/jquery.ui.tabs.js vendored
View File

@ -45,8 +45,7 @@ $.widget( "ui.tabs", {
}, },
_create: function() { _create: function() {
var panel, var that = this,
that = this,
options = this.options, options = this.options,
active = options.active, active = options.active,
locationHash = location.hash.substring( 1 ); locationHash = location.hash.substring( 1 );
@ -295,8 +294,7 @@ $.widget( "ui.tabs", {
}, },
refresh: function() { refresh: function() {
var next, var options = this.options,
options = this.options,
lis = this.tablist.children( ":has(a[href])" ); lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML // get disabled tabs from class attribute from HTML
@ -922,7 +920,7 @@ if ( $.uiBackCompat !== false ) {
this._super(); this._super();
}, },
url: function( index, url ){ url: function( index ){
this.anchors.eq( index ).removeData( "cache.tabs" ); this.anchors.eq( index ).removeData( "cache.tabs" );
this._superApply( arguments ); this._superApply( arguments );
} }
@ -1158,7 +1156,7 @@ if ( $.uiBackCompat !== false ) {
} }
}, },
_eventHandler: function( event ) { _eventHandler: function() {
this._superApply( arguments ); this._superApply( arguments );
this.options.selected = this.options.active; this.options.selected = this.options.active;
if ( this.options.selected === false ) { if ( this.options.selected === false ) {
@ -1254,7 +1252,7 @@ if ( $.uiBackCompat !== false ) {
this._cookie( this.options.active, this.options.cookie ); this._cookie( this.options.active, this.options.cookie );
} }
}, },
_eventHandler: function( event ) { _eventHandler: function() {
this._superApply( arguments ); this._superApply( arguments );
if ( this.options.cookie ) { if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie ); this._cookie( this.options.active, this.options.cookie );

View File

@ -284,7 +284,7 @@ $.widget( "ui.tooltip", {
this.close( fakeEvent, true ); this.close( fakeEvent, true );
} }
}, },
remove: function( event ) { remove: function() {
this._removeTooltip( tooltip ); this._removeTooltip( tooltip );
} }
}; };
@ -297,7 +297,7 @@ $.widget( "ui.tooltip", {
this._on( target, events ); this._on( target, events );
}, },
close: function( event, force ) { close: function( event ) {
var that = this, var that = this,
target = $( event ? event.currentTarget : this.element ), target = $( event ? event.currentTarget : this.element ),
tooltip = this._find( target ); tooltip = this._find( target );

View File

@ -200,7 +200,7 @@ $.widget.bridge = function( name, object ) {
}; };
}; };
$.Widget = function( options, element ) {}; $.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = []; $.Widget._childConstructors = [];
$.Widget.prototype = { $.Widget.prototype = {