"node": true,
"onevar": true,
"trailing": true,
- "undef": true
+ "undef": true,
+ "unused": true
}
function walk( methods ) {
var method = methods.shift();
- function next( error ) {
+ function next() {
if ( methods.length ) {
walk( methods );
}
opts: {
cwd: 'dist'
}
- }, function( err, result ) {
+ }, function( err ) {
if ( err ) {
grunt.log.error( err );
done();
"onevar": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
- "addMonths",
"asyncTest",
"container",
"deepEqual",
"Globalize",
"heightAfter",
"init",
- "isNotOpen",
- "isOpen",
"modal",
"module",
"moved",
"offsetAfter",
"offsetBefore",
"ok",
- "PROP_NAME",
"QUnit",
- "restoreScroll",
- "shouldBeDroppable",
- "shouldmove",
- "shouldNotBeDroppable",
- "shouldnotmove",
- "shouldnotresize",
- "shouldresize",
"start",
"strictEqual",
"stop",
function arrowsMoveFocus( id, isKeyUp ) {
expect( 1 );
- var didMove = false,
- element = $( id ).autocomplete({
+ var element = $( id ).autocomplete({
source: [ "a" ],
delay: 0,
minLength: 0
], "response ui.content" );
ui.content.splice( 0, 1 );
},
- open: function( event ) {
+ open: function() {
ok( menu.is( ":visible" ), "menu open on open" );
},
focus: function( event, ui ) {
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- focus: function( event, ui ) {
+ focus: function() {
$( this ).val( customVal );
return false;
}
element = $( "#autocomplete" ).autocomplete({
delay: 0,
source: data,
- select: function( event, ui ) {
+ select: function() {
$( this ).val( customVal );
return false;
}
autoFocus: afValue,
delay: 0,
source: data,
- open: function( event, ui ) {
+ open: function() {
equal( element.autocomplete( "widget" ).children( ".ui-menu-item:first" ).find( ".ui-state-focus" ).length,
focusedLength, "first item is " + (afValue ? "" : "not") + " auto focused" );
start();
/*
* button_events.js
*/
-(function($) {
+(function() {
module("button: events");
equal(d1.toString(), d2.toString(), message);
}
-function equalsDateArray(a1, a2, message) {
- if (!a1 || !a2) {
- ok(false, message + ' - missing dates');
- return;
- }
- a1[0] = (a1[0] ? new Date(a1[0].getFullYear(), a1[0].getMonth(), a1[0].getDate()) : '');
- a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : '');
- a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : '');
- a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : '');
- deepEqual(a1, a2, message);
-}
-
-function addMonths(date, offset) {
+TestHelpers.addMonths = function(date, offset) {
var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate();
date.setDate(Math.min(date.getDate(), maxDay));
date.setMonth(date.getMonth() + offset);
return date;
-}
+};
function init(id, options) {
$.datepicker.setDefaults($.datepicker.regional['']);
return $(id).datepicker($.extend({showAnim: ''}, options || {}));
}
-var PROP_NAME = 'datepicker';
+TestHelpers.PROP_NAME = 'datepicker';
(function($) {
* datepicker_defaults.js
*/
+/*
var datepicker_defaults = {
disabled: false
};
-//TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
+*/
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equal(selectedThis, inp[0], 'Callback selected this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback selected inst');
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date');
inp.val('').datepicker('show').
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP});
date.setMonth(date.getMonth() - 1);
equal(selectedThis, inp[0], 'Callback change month/year this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback change month/year inst');
equal(selectedDate, newMonthYear(date),
'Callback change month/year date - pgup');
inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN});
val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
equal(selectedThis, inp[0], 'Callback close this');
- equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst');
+ equal(selectedInst, $.data(inp[0], TestHelpers.PROP_NAME), 'Callback close inst');
equal(selectedDate, '', 'Callback close date - esc');
inp.val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
var inl,
inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Default - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance present');
ok(inp.next().is('#alt'), 'Default - button absent');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Default - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Default - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Default - instance absent');
ok(inp.next().is('#alt'), 'Default - button absent');
// With button
inp= init('#inp', {showOn: 'both'});
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Button - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance present');
ok(inp.next().text() === '...', 'Button - button added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Button - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Button - instance absent');
ok(inp.next().is('#alt'), 'Button - button removed');
// With append text
inp = init('#inp', {appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Append - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance present');
ok(inp.next().text() === 'Testing', 'Append - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Append - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Append - instance absent');
ok(inp.next().is('#alt'), 'Append - append text removed');
// With both
inp= init('#inp', {showOn: 'both', buttonImageOnly: true,
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
- ok($.data(inp[0], PROP_NAME), 'Both - instance present');
+ ok($.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance present');
ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
ok(inp.next().next().text() === 'Testing', 'Both - append text added');
inp.datepicker('destroy');
inp = $('#inp');
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
- ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
+ ok(!$.data(inp[0], TestHelpers.PROP_NAME), 'Both - instance absent');
ok(inp.next().is('#alt'), 'Both - button and append text absent');
// Inline
inl = init('#inl');
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
ok(inl.html() !== '', 'Inline - datepicker present');
- ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
+ ok($.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance present');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
inl.datepicker('destroy');
inl = $('#inl');
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
ok(inl.html() === '', 'Inline - datepicker absent');
- ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
+ ok(!$.data(inl[0], TestHelpers.PROP_NAME), 'Inline - instance absent');
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
});
test('setDefaults', function() {
expect( 3 );
- var inp = init('#inp');
+ init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'});
equal($.datepicker._defaults.showOn, 'button', 'Change default showOn');
test('option', function() {
expect( 17 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
// Set option
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
test('change', function() {
expect( 12 );
var inp = init('#inp'),
- inst = $.data(inp[0], PROP_NAME);
+ inst = $.data(inp[0], TestHelpers.PROP_NAME);
equal(inst.settings.showOn, null, 'Initial setting showOn');
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
inp.datepicker('option', {defaultDate: ' -1 m '}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), -1);
+ date = TestHelpers.addMonths(new Date(), -1);
equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m');
inp.datepicker('option', {defaultDate: '+2M'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 2);
+ date = TestHelpers.addMonths(new Date(), 2);
equalsDate(inp.datepicker('getDate'), date, 'Default date +2M');
inp.datepicker('option', {defaultDate: '-2y'}).
datepicker('hide').val('').datepicker('show').
inp.datepicker('option', {defaultDate: '+1M +10d'}).
datepicker('hide').val('').datepicker('show').
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d');
// String date values
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
equalsDate(inp.datepicker('getDate'), date,
'Min/max - -1w, +1 M +10 D - ctrl+pgup');
- date = addMonths(new Date(), 1);
+ date = TestHelpers.addMonths(new Date(), 1);
date.setDate(date.getDate() + 10);
inp.val('').datepicker('show');
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}).
(date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
}
-function calcWeek(date) {
- var doy = date.getDate() + 6,
- m = date.getMonth() - 1;
- for (; m >= 0; m--) {
- doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
- }
- // Simple count from 01/01 starting at week 1
- return Math.floor(doy / 7);
-}
-
test('callbacks', function() {
expect( 13 );
// Before show
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
expect( 3 );
- var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
+ var inp = init('#inp', {beforeShowDay: function() { inp.datepicker('getDate'); return [true, '']; }}),
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
// contains non-breaking space
return el.dialog('widget');
}
-function isOpen(why) {
+TestHelpers.isOpen = function(why) {
ok(dlg().is(":visible"), why);
-}
+};
-function isNotOpen(why) {
+TestHelpers.isNotOpen = function(why) {
ok(!dlg().is(":visible"), why);
-}
+};
function drag(handle, dx, dy) {
var d = dlg();
widthAfter = d.width();
}
-function moved(dx, dy, msg) {
+TestHelpers.dialogMoved = function(dx, dy, msg) {
msg = msg ? msg + "." : "";
var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) },
expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) };
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
-}
+};
-function shouldmove(why) {
+TestHelpers.shouldmove = function(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50);
- moved(50, -50, why);
-}
+ TestHelpers.dialogMoved(50, -50, why);
+};
-function shouldnotmove(why) {
+TestHelpers.shouldnotmove = function(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, -50);
- moved(0, 0, why);
-}
+ TestHelpers.dialogMoved(0, 0, why);
+};
-function resized(dw, dh, msg) {
+TestHelpers.resized = function(dw, dh, msg) {
msg = msg ? msg + "." : "";
var actual = { width: widthAfter, height: heightAfter },
expected = { width: widthBefore + dw, height: heightBefore + dh };
deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
-}
+};
-function shouldresize(why) {
+TestHelpers.shouldresize = function(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
- resized(50, 50, why);
-}
+ TestHelpers.resized(50, 50, why);
+};
-function shouldnotresize(why) {
+TestHelpers.shouldnotresize = function(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
- resized(0, 0, why);
-}
-
-function broder(el, side){
- return parseInt(el.css('border-' + side + '-width'), 10);
-}
-
-function margin(el, side) {
- return parseInt(el.css('margin-' + side), 10);
-}
+ TestHelpers.resized(0, 0, why);
+};
(function($) {
}
});
el.dialog('close');
- isOpen('beforeClose callback should prevent dialog from closing');
+ TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove();
el = $('<div></div>').dialog();
return false;
});
el.dialog('close');
- isOpen('beforeClose callback should prevent dialog from closing');
+ TestHelpers.isOpen('beforeClose callback should prevent dialog from closing');
el.remove();
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
return false;
});
el.dialog('close');
- isOpen('dialogbeforeclose event should prevent dialog from closing');
+ TestHelpers.isOpen('dialogbeforeclose event should prevent dialog from closing');
el.remove();
});
ok(true, '.dialog() called on disconnected DOMElement - removed');
el = $('<div></div>').dialog();
- var foo = el.dialog("option", "foo");
+ el.dialog("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
expect(2);
el = $('<div></div>').dialog({ autoOpen: false });
- isNotOpen('.dialog({ autoOpen: false })');
+ TestHelpers.isNotOpen('.dialog({ autoOpen: false })');
el.remove();
el = $('<div></div>').dialog({ autoOpen: true });
- isOpen('.dialog({ autoOpen: true })');
+ TestHelpers.isOpen('.dialog({ autoOpen: true })');
el.remove();
});
var btn, i, newButtons,
buttons = {
- "Ok": function(ev, ui) {
+ "Ok": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target");
},
- "Cancel": function(ev, ui) {
+ "Cancel": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[1], "event target");
equal(btn.length, 2, "number of buttons");
i = 0;
- $.each(buttons, function(key, val) {
+ $.each(buttons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1));
i++;
});
btn.trigger("click");
newButtons = {
- "Close": function(ev, ui) {
+ "Close": function( ev ) {
ok(true, "button click fires callback");
equal(this, el[0], "context of callback");
equal(ev.target, btn[0], "event target");
btn.trigger('click');
i = 0;
- $.each(newButtons, function(key, val) {
+ $.each(newButtons, function( key ) {
equal(btn.eq(i).text(), key, "text of button " + (i+1));
i += 1;
});
expect(4);
el = $('<div></div>').dialog({ draggable: false });
- shouldnotmove();
+ TestHelpers.shouldnotmove();
el.dialog('option', 'draggable', true);
- shouldmove();
+ TestHelpers.shouldmove();
el.remove();
el = $('<div></div>').dialog({ draggable: true });
- shouldmove();
+ TestHelpers.shouldmove();
el.dialog('option', 'draggable', false);
- shouldnotmove();
+ TestHelpers.shouldnotmove();
el.remove();
});
expect(4);
el = $('<div></div>').dialog();
- shouldresize("[default]");
+ TestHelpers.shouldresize("[default]");
el.dialog('option', 'resizable', false);
- shouldnotresize('disabled after init');
+ TestHelpers.shouldnotresize('disabled after init');
el.remove();
el = $('<div></div>').dialog({ resizable: false });
- shouldnotresize("disabled in init options");
+ TestHelpers.shouldnotresize("disabled in init options");
el.dialog('option', 'resizable', true);
- shouldresize('enabled after init');
+ TestHelpers.shouldresize('enabled after init');
el.remove();
});
var i;
el = $('<div></div>').dialog({ resizable: false });
- shouldnotresize("[default]");
+ TestHelpers.shouldnotresize("[default]");
for (i=0; i<2; i++) {
el.dialog('close').dialog('open');
- shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
+ TestHelpers.shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
}
el.remove();
el = $('<div></div>').dialog({ resizable: true });
- shouldresize("[default]");
+ TestHelpers.shouldresize("[default]");
for (i=0; i<2; i++) {
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
- shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
+ TestHelpers.shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
}
el.remove();
var el, offsetBefore, offsetAfter, dragged;
function drag(handle, dx, dy) {
- var element = el.data("draggable").element;
offsetBefore = el.offset();
$(handle).simulate("drag", {
dx: dx || 0,
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
-function restoreScroll(what) {
- if(what) {
+TestHelpers.restoreScroll = function( what ) {
+ if( what ) {
$(document).scrollTop(0); $(document).scrollLeft(0);
} else {
$("#main")[0].scrollTop = 0; $("#main")[0].scrollLeft = 0;
el = $("#draggable2").draggable({
cursor: expected,
- start: function(event, ui) {
+ start: function() {
actual = getCursor();
}
});
el = $("#draggable2").draggable({
cursor: expected,
- start: function(event, ui) {
+ start: function() {
actual = getCursor();
}
});
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
setScroll();
testScroll('absolute');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
setScroll('root');
testScroll('absolute');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
setScroll('root');
testScroll('absolute');
- restoreScroll();
- restoreScroll('root');
+ TestHelpers.restoreScroll();
+ TestHelpers.restoreScroll('root');
});
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll();
+ TestHelpers.restoreScroll();
});
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll('root');
+ TestHelpers.restoreScroll('root');
});
drag(el, 1, 1);
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
- restoreScroll('root');
- restoreScroll();
+ TestHelpers.restoreScroll('root');
+ TestHelpers.restoreScroll();
});
var opacity = null;
el = $("#draggable2").draggable({
opacity: 0.5,
- start: function(event, ui) {
+ start: function() {
opacity = $(this).css("opacity");
}
});
expect(1);
var actual,
- expected = 10,
- zIndex = null;
+ expected = 10;
+
el = $("#draggable2").draggable({
zIndex: expected,
- start: function(event, ui) {
+ start: function() {
actual = $(this).css("zIndex");
}
});
* droppable_core.js
*/
-var el, drg;
+var el;
-function shouldBeDroppable() {
+TestHelpers.shouldBeDroppable = function() {
ok(false, 'missing test - untested code is broken code');
-}
+};
-function shouldNotBeDroppable() {
+TestHelpers.shouldNotBeDroppable = function() {
ok(false, 'missing test - untested code is broken code');
-}
+};
(function($) {
el = $(document.createElement(typeName)).appendTo('body');
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
el.droppable();
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("destroy");
el.remove();
});
module("droppable: events");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
test("activate", function() {
ok(false, 'missing test - untested code is broken code');
});
test("enable", function() {
expect(7);
el = $("#droppable1").droppable({ disabled: true });
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
el.droppable("enable");
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
equal(el.droppable("option", "disabled"), false, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: true });
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
el.droppable("option", "disabled", false);
equal(el.droppable("option", "disabled"), false, "disabled option setter");
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
var expected = $('<div></div>').droppable(),
actual = expected.droppable('enable');
test("disable", function() {
expect(7);
el = $("#droppable1").droppable({ disabled: false });
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("disable");
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
equal(el.droppable("option", "disabled"), true, "disabled option getter");
el.droppable("destroy");
el.droppable({ disabled: false });
- shouldBeDroppable();
+ TestHelpers.shouldBeDroppable();
el.droppable("option", "disabled", true);
equal(el.droppable("option", "disabled"), true, "disabled option setter");
- shouldNotBeDroppable();
+ TestHelpers.shouldNotBeDroppable();
var expected = $('<div></div>').droppable(),
actual = expected.droppable('disable');
var minDuration = 15,
// duration is used for "long" animates where we plan on testing properties during animation
- duration = 200,
-
- // mid is used for testing in the "middle" of the "duration" animations
- mid = duration / 2;
+ duration = 200;
module( "effects.core" );
module( "effects.core: animateClass" );
asyncTest( "animateClass works with borderStyle", function() {
- var test = $("div.animateClass"),
- count = 0;
+ var test = $("div.animateClass");
expect(3);
test.toggleClass("testAddBorder", minDuration, function() {
test.toggleClass("testAddBorder", minDuration, function() {
asyncTest( "animateClass works with colors", function() {
var test = $("div.animateClass"),
- count = 0,
oldStep = jQuery.fx.step.backgroundColor;
+
expect(2);
// we want to catch the first frame of animation
asyncTest( "animateClass calls step option", 1, function() {
var test = jQuery( "div.animateClass" ),
- step = function( fx ) {
+ step = function() {
ok( true, "Step Function Called" );
test.stop();
start();
equal( hidden.css("display"), "block", "Hidden is shown after .show(\"" +effect+ "\", time)" );
})).queue( queueTest() ).hide( effect, minDuration, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
- })).queue( queueTest(function(next) {
+ })).queue( queueTest(function() {
deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
start();
}));
test( "handle click on menu", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
}
});
test( "handle click on custom item menu", function() {
expect( 1 );
var element = $( "#menu5" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
},
menus: "div"
expect( 1 );
var blurHandled = false,
element = $( "#menu1" ).menu({
- blur: function( event, ui ) {
+ blur: function( event ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
blurHandled = true;
expect( 1 );
var blurHandled = false,
element = $( "#menu1" ).menu({
- blur: function( event, ui ) {
+ blur: function( event ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
blurHandled = true;
test( "handle focus of menu with active item", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( logOutput(), "keydown,1", "Keydown focus but not select disabled item" );
test( "handle keyboard navigation with spelling of menu items", function() {
expect( 2 );
var element = $( "#menu2" ).menu({
- focus: function( event, ui ) {
+ focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log( "keydown", true );
- element.one( "menufocus", function( event, ui ) {
+ element.one( "menufocus", function() {
element.simulate( "keydown", { keyCode: 65 } );
element.simulate( "keydown", { keyCode: 68 } );
element.simulate( "keydown", { keyCode: 68 } );
test( "enable/disable", function() {
expect( 3 );
var element = $( "#menu1" ).menu({
- select: function( event, ui ) {
+ select: function() {
log();
}
});
expect( 2 );
var element = $( "#menu1" ).menu({
disabled: true,
- select: function(event, ui) {
+ select: function() {
log();
}
});
expect( 2 );
var element = $( "#menu1" ).menu({
disabled: false,
- select: function( event, ui ) {
+ select: function() {
log();
}
});
* resizable_core.js
*/
-var el;
-
-var drag = function(el, dx, dy, complete) {
+TestHelpers.resizableDrag = function(el, dx, dy, complete) {
// speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated.
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 0, -50);
+ TestHelpers.resizableDrag(handle, 0, -50);
equal( target.height(), 150, "compare height" );
- drag(handle, 0, 50);
+ TestHelpers.resizableDrag(handle, 0, 50);
equal( target.height(), 100, "compare height" );
});
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 0, 50);
+ TestHelpers.resizableDrag(handle, 0, 50);
equal( target.height(), 150, "compare height" );
- drag(handle, 0, -50);
+ TestHelpers.resizableDrag(handle, 0, -50);
equal( target.height(), 100, "compare height" );
});
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 50);
+ TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 150, "compare width");
- drag(handle, -50);
+ TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 100, "compare width" );
});
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50);
+ TestHelpers.resizableDrag(handle, -50);
equal( target.width(), 150, "compare width" );
- drag(handle, 50);
+ TestHelpers.resizableDrag(handle, 50);
equal( target.width(), 100, "compare width" );
});
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 50, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 50, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 150, "compare width" );
equal( target.height(), 150, "compare height" );
- drag(handle, 50, 50);
+ TestHelpers.resizableDrag(handle, 50, 50);
equal( target.width(), 100, "compare width" );
equal( target.height(), 100, "compare height" );
});
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);
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);
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, 80);
+ TestHelpers.resizableDrag(handle, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -130);
+ TestHelpers.resizableDrag(handle, -130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, -80);
+ TestHelpers.resizableDrag(handle, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 130);
+ TestHelpers.resizableDrag(handle, 130);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, 0, -80);
+ TestHelpers.resizableDrag(handle, 0, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 0, 80);
+ TestHelpers.resizableDrag(handle, 0, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, 0, 80);
+ TestHelpers.resizableDrag(handle, 0, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 0, -80);
+ TestHelpers.resizableDrag(handle, 0, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, 80, 80);
+ TestHelpers.resizableDrag(handle, 80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -80, -80);
+ TestHelpers.resizableDrag(handle, -80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, -80, 80);
+ TestHelpers.resizableDrag(handle, -80, 80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, 80, -80);
+ TestHelpers.resizableDrag(handle, 80, -80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
- drag(handle, 80, -80);
+ TestHelpers.resizableDrag(handle, 80, -80);
equal( target.width(), 130, "compare maxWidth");
equal( target.height(), 130, "compare maxHeight");
- drag(handle, -80, 80);
+ TestHelpers.resizableDrag(handle, -80, 80);
equal( target.width(), 70, "compare minWidth");
equal( target.height(), 70, "compare minHeight");
});
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
- drag(handle, 3, 9);
+ TestHelpers.resizableDrag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- drag(handle, 15, 11);
+ TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
- drag(handle, 3, 9);
+ TestHelpers.resizableDrag(handle, 3, 9);
equal( target.width(), 103, "compare width");
equal( target.height(), 100, "compare height");
- drag(handle, 15, 11);
+ TestHelpers.resizableDrag(handle, 15, 11);
equal( target.width(), 118, "compare width");
equal( target.height(), 120, "compare height");
});
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- drag(handle, -50, -50);
+ TestHelpers.resizableDrag(handle, -50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, 70, 70);
+ TestHelpers.resizableDrag(handle, 70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- drag(handle, 50, -50);
+ TestHelpers.resizableDrag(handle, 50, -50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, -70, 70);
+ TestHelpers.resizableDrag(handle, -70, 70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- drag(handle, -50, 50);
+ TestHelpers.resizableDrag(handle, -50, 50);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, 70, -70);
+ TestHelpers.resizableDrag(handle, 70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
- drag(handle, 70, 70);
+ TestHelpers.resizableDrag(handle, 70, 70);
equal( target.width(), 60, "compare minWidth" );
equal( target.height(), 60, "compare minHeight" );
- drag(handle, -70, -70);
+ TestHelpers.resizableDrag(handle, -70, -70);
equal( target.width(), 100, "compare maxWidth" );
equal( target.height(), 100, "compare maxHeight" );
});
var el;
-var drag = function(dx, dy) {
+TestHelpers.selectableDrag = function drag(dx, dy) {
var off = el.offset(), pos = { clientX: off.left, clientY: off.top };
el.simulate("mousedown", pos);
$(document).simulate("mousemove", pos);
expect(2);
el = $("#selectable1");
el.selectable({
- start: function(ev, ui) {
+ start: function() {
ok(true, "drag fired start callback");
equal(this, el[0], "context of callback");
}
expect(2);
el = $("#selectable1");
el.selectable({
- start: function(ev, ui) {
+ start: function() {
ok(true, "drag fired stop callback");
equal(this, el[0], "context of callback");
}
ok(true, 'arbitrary method called after init');
el = $("<div></div>").selectable();
- var foo = el.selectable("option", "foo");
+ el.selectable("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
actual = 0;
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
sel.hide();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length);
el.selectable("destroy");
sel.show();
el = $("#selectable1").selectable({ autoRefresh: true, selected: selected });
sel.hide();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, 0);
sel.show();
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
equal(actual, sel.length);
el.selectable("destroy");
sel.show();
actual = 0;
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
- drag(1000, 1000);
+ TestHelpers.selectableDrag(1000, 1000);
ok(sel.length !== 1, "this test assumes more than 1 selectee");
equal(actual, 1);
el.selectable("destroy");
var el = $( "#slider1" )
.slider({
- start: function(event, ui) {
+ start: function( event ) {
equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" );
},
- slide: function(event, ui) {
+ slide: function( event) {
equal( event.originalEvent.type, "mousemove", "slider triggered by mousemove" );
},
- stop: function(event, ui) {
+ stop: function( event ) {
equal( event.originalEvent.type, "mouseup", "stop triggered by mouseup" );
},
- change: function(event, ui) {
+ change: function( event ) {
equal( event.originalEvent.type, "mouseup", "change triggered by mouseup" );
}
});
// Test keyup at end of handle slide (keyboard)
var el = $( "#slider1" )
.slider({
- start: function(event, ui) {
+ start: function( event ) {
equal( event.originalEvent.type, "keydown", "start triggered by keydown" );
},
- slide: function(event, ui) {
+ slide: function() {
ok( false, "Slider never triggered by keys" );
},
- stop: function(event, ui) {
+ stop: function( event ) {
equal( event.originalEvent.type, "keyup", "stop triggered by keyup" );
},
- change: function(event, ui) {
+ change: function( event ) {
equal( event.originalEvent.type, "keyup", "change triggered by keyup" );
}
});
// Test value method
var el = $( "<div></div>" )
.slider({
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by value method" );
}
})
el = $( "<div></div>" )
.slider({
values: [ 10, 20 ],
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by values method" );
}
})
// Test value option
el = $( "<div></div>" )
.slider({
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by value option" );
}
})
el = $( "<div></div>" )
.slider({
values: [ 10, 20 ],
- change: function(event, ui) {
+ change: function() {
ok( true, "change triggered by values option" );
}
})
$('<div></div>').slider().remove();
ok(true, '.slider() called on disconnected DOMElement');
- var el = $('<div></div>').slider(),
- foo = el.slider("option", "foo");
+ var el = $('<div></div>').slider();
+ el.slider("option", "foo");
el.remove();
ok(true, 'arbitrary option getter after init');
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);
module("sortable: options");
+// this is here to make JSHint pass "unused", and we don't want to
+// remove the parameter for when we finally implement
+$.noop();
+
test("{ appendTo: 'parent' }, default", function() {
ok(false, "missing test - untested code is broken code.");
});
$('#main ul').sortable({
connectWith: '#main ul',
- change: function (e, ui) {
+ change: function () {
fired.change = true;
},
- receive: function (e, ui) {
+ receive: function () {
fired.receive = true;
},
- remove: function (e, ui) {
+ remove: function () {
fired.remove = true;
}
});
(function( $ ) {
-var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
-
module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat
test( "incremental, false", function() {
expect( 100 );
- var i, diff,
+ var i,
prev = 0,
element = $( "#spin" ).val( prev ).spinner({
incremental: false,
});
}
- var i, diff,
+ var i,
prev = 0,
expected = [].concat( fill( 18, 1 ), fill( 37, 2 ), fill( 14, 3 ),
fill( 9, 4 ), fill( 6, 5 ), fill( 5, 6 ), fill ( 5, 7 ),
asyncTest( "accessibility - ajax", function() {
expect( 4 );
var element = $( "#tabs2" ).tabs(),
- tab = element.find( ".ui-tabs-nav li" ).eq( 3 ),
panel = $( "#custom-id" );
equal( panel.attr( "aria-live" ), "polite", "remote panel has aria-live" );
test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
expect( 1 );
- var element = $( "#tabs2" ).tabs({
+ $( "#tabs2" ).tabs({
active: 2,
beforeLoad: function( event, ui ) {
event.preventDefault();
var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
element.appendTo( "#main" );
element.tabs({
- beforeLoad: function( event, ui ) {
+ beforeLoad: function() {
event.preventDefault();
ok( false, "should not be an ajax tab" );
}
var element = $( "#tabs2" ).tabs({
cache: true
});
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
ok( true, "tabsload" );
setTimeout(function() {
element.tabs( "option", "active", 0 );
state( element, 1, 0, 0, 0, 0 );
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
state( element, 0, 0, 1, 0, 0 );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
ok( false, "should be cached" );
});
element.tabs( "option", "active", 2 );
var element = $( "#tabs2" ).tabs();
- element.one( "tabsbeforeload", function( event, ui ) {
+ element.one( "tabsbeforeload", function() {
equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
});
- element.one( "tabsload", function( event, ui ) {
+ element.one( "tabsload", function() {
// wait until after the load finishes before checking for the spinner to be removed
setTimeout(function() {
equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
state( element, 0, 1, 0 );
// collapsing
- element.one( "tabsshow", function( event, ui ) {
+ element.one( "tabsshow", function() {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
state( element, 0, 1, 0 );
// collapsing
- element.one( "tabsselect", function( event, ui ) {
+ element.one( "tabsselect", function() {
ok( false, "collapsing" );
});
element.tabs( "option", "active", false );
// ensure that all defaults were tested
test( "tested defaults", function() {
var count = 0;
- $.each( pluginDefaults, function( key, val ) {
+ $.each( pluginDefaults, function( key ) {
expect( ++count );
ok( key in defaults, key );
});
delete result.data[ $.expando ];
children = elem.children();
if ( children.length ) {
- result.children = elem.children().map(function( ind ) {
+ result.children = elem.children().map(function() {
return extract( $( this ) );
}).get();
} else {
test( "content: string", function() {
expect( 1 );
- var element = $( "#tooltipped1" ).tooltip({
+ $( "#tooltipped1" ).tooltip({
content: "just a string",
open: function( event, ui ) {
equal( ui.tooltip.text(), "just a string" );
_init: function() {
actions.push( "init" );
},
- _setOption: function( key, value ) {
+ _setOption: function( key ) {
actions.push( "option" + key );
}
});
});
$( "#widget" ).testWidget({
- foo: function( event, ui ) {
+ foo: function() {
ok( true, "callback invoked even if event is cancelled" );
}
})
- .bind( "testwidgetfoo", function( event, ui ) {
+ .bind( "testwidgetfoo", function() {
ok( true, "event was triggered" );
return false;
});
});
$( "#widget" ).testWidget({
- foo: function( event, ui ) {
+ foo: function() {
return false;
}
});
"onevar": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
"Globalize"
]
_create.call( this );
},
- _setOption: function( key, value ) {
+ _setOption: function( key ) {
if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
this.options.heightStyle = this._mergeHeightStyle();
}
url: url,
data: request,
dataType: "json",
- success: function( data, status ) {
+ success: function( data ) {
response( data );
},
error: function() {
return this.menu.element;
},
- _value: function( value ) {
+ _value: function() {
return this.valueMethod.apply( this.element, arguments );
},
options = this.options,
title = options.title || " ",
+ uiDialog,
+ uiDialogTitlebar,
+ uiDialogTitlebarClose,
+ uiDialogTitle,
+ uiDialogButtonPane;
uiDialog = ( this.uiDialog = $( "<div>" ) )
.addClass( uiDialogClasses + options.dialogClass )
.mousedown(function( event ) {
that.moveToTop( false, event );
})
- .appendTo( "body" ),
+ .appendTo( "body" );
- uiDialogContent = this.element
+ this.element
.show()
.removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" )
- .appendTo( uiDialog ),
+ .appendTo( uiDialog );
uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
.addClass( "ui-dialog-titlebar ui-widget-header " +
// Dialog isn't getting focus when dragging (#8063)
uiDialog.focus();
})
- .prependTo( uiDialog ),
+ .prependTo( uiDialog );
uiDialogTitlebarClose = $( "<a href='#'></a>" )
.addClass( "ui-dialog-titlebar-close ui-corner-all" )
event.preventDefault();
that.close( event );
})
- .appendTo( uiDialogTitlebar ),
+ .appendTo( uiDialogTitlebar );
- uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
.addClass( "ui-icon ui-icon-closethick" )
.text( options.closeText )
- .appendTo( uiDialogTitlebarClose ),
+ .appendTo( uiDialogTitlebarClose );
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
.html( title )
- .prependTo( uiDialogTitlebar ),
+ .prependTo( uiDialogTitlebar );
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
- .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
- uiButtonSet = ( this.uiButtonSet = $( "<div>" ) )
+ ( this.uiButtonSet = $( "<div>" ) )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );
},
_createButtons: function( buttons ) {
- var uiDialogButtonPane, uiButtonSet,
- that = this,
+ var that = this,
hasButtons = false;
// if we already have a button pane, remove it
var inst = this,
type = jQuery.type( red ),
- rgba = this._rgba = [],
- source;
+ rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
rgba.push( ~~( alpha * 255 ) );
}
- return "#" + jQuery.map( rgba, function( v, i ) {
+ return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
- p = 2 * l - q,
- r, g, b;
+ p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
this.currentStyle,
newStyle = {},
key,
- camelCase,
len;
// webkit enumerates style porperties
}
$.fn.extend({
- effect: function( effect, options, speed, callback ) {
+ effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode,
queue = args.queue,
return true;
},
- _mouseStart: function( event ) {
+ _mouseStart: function() {
return true;
},
_set = {};
if ( this.options.values && this.options.values.length ) {
- this.handles.each(function( i, j ) {
+ this.handles.each(function( i ) {
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
},
_create: function() {
- var panel,
- that = this,
+ var that = this,
options = this.options,
active = options.active,
locationHash = location.hash.substring( 1 );
},
refresh: function() {
- var next,
- options = this.options,
+ var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
this._super();
},
- url: function( index, url ){
+ url: function( index ){
this.anchors.eq( index ).removeData( "cache.tabs" );
this._superApply( arguments );
}
}
},
- _eventHandler: function( event ) {
+ _eventHandler: function() {
this._superApply( arguments );
this.options.selected = this.options.active;
if ( this.options.selected === false ) {
this._cookie( this.options.active, this.options.cookie );
}
},
- _eventHandler: function( event ) {
+ _eventHandler: function() {
this._superApply( arguments );
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
this.close( fakeEvent, true );
}
},
- remove: function( event ) {
+ remove: function() {
this._removeTooltip( tooltip );
}
};
this._on( target, events );
},
- close: function( event, force ) {
+ close: function( event ) {
var that = this,
target = $( event ? event.currentTarget : this.element ),
tooltip = this._find( target );
};
};
-$.Widget = function( options, element ) {};
+$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {