diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-10-23 09:36:42 -0500 |
---|---|---|
committer | Corey Frang <gnarf@gnarf.net> | 2012-10-23 09:37:46 -0500 |
commit | e1230997aa14dae6f35326c8ba20bfe2428507c2 (patch) | |
tree | f00984f5fbbf12f175c0994c497513a2d8e8ee26 /tests/unit/dialog | |
parent | 7af1ec727bcca8367e804cea77b9dd238b1c0d69 (diff) | |
download | jquery-ui-e1230997aa14dae6f35326c8ba20bfe2428507c2.tar.gz jquery-ui-e1230997aa14dae6f35326c8ba20bfe2428507c2.zip |
Build: Enable "unused" option in jshint - Remove unused variables from codebase. - Closes gh-788
Squashed commit of the following:
commit 7f19f92c646f180bc067bb24123175251a64a9d6
Author: Mike Sherov <mike.sherov@gmail.com>
Date: Tue Oct 23 10:34:28 2012 -0400
put back in fake args for signatures that we want to keep
commit 257505a9e69da0c53e3a989dab87a13112045a29
Author: Mike Sherov <mike.sherov@gmail.com>
Date: Tue Oct 23 08:10:20 2012 -0400
changes per @scott_gonzalez
commit 12725480cb58e70865e5aa6e735009b6b035c8f3
Author: Mike Sherov <mike.sherov@gmail.com>
Date: Mon Oct 22 22:54:05 2012 -0400
clean up unused vars in ui directory
commit 563595e7aee5d4a5c096b2d1de655abdf920aacd
Author: Mike Sherov <mike.sherov@gmail.com>
Date: Mon Oct 22 22:37:42 2012 -0400
clean up unused vars in grunt and tests
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r-- | tests/unit/dialog/dialog_core.js | 48 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_events.js | 6 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 2 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_options.js | 30 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_tickets.js | 8 |
5 files changed, 43 insertions, 51 deletions
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index e0a5c8701..a9e5e9be2 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -12,13 +12,13 @@ function dlg() { return el.dialog('widget'); } -function isOpen(why) { +TestHelpers.isOpen = function(why) { ok(dlg().is(":visible"), why); -} +}; -function isNotOpen(why) { +TestHelpers.isNotOpen = function(why) { ok(!dlg().is(":visible"), why); -} +}; function drag(handle, dx, dy) { var d = dlg(); @@ -38,51 +38,43 @@ function drag(handle, dx, dy) { widthAfter = d.width(); } -function moved(dx, dy, msg) { +TestHelpers.dialogMoved = function(dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) }, expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) }; deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); -} +}; -function shouldmove(why) { +TestHelpers.shouldmove = function(why) { var handle = $(".ui-dialog-titlebar", dlg()); drag(handle, 50, -50); - moved(50, -50, why); -} + TestHelpers.dialogMoved(50, -50, why); +}; -function shouldnotmove(why) { +TestHelpers.shouldnotmove = function(why) { var handle = $(".ui-dialog-titlebar", dlg()); drag(handle, 50, -50); - moved(0, 0, why); -} + TestHelpers.dialogMoved(0, 0, why); +}; -function resized(dw, dh, msg) { +TestHelpers.resized = function(dw, dh, msg) { msg = msg ? msg + "." : ""; var actual = { width: widthAfter, height: heightAfter }, expected = { width: widthBefore + dw, height: heightBefore + dh }; deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); -} +}; -function shouldresize(why) { +TestHelpers.shouldresize = function(why) { var handle = $(".ui-resizable-se", dlg()); drag(handle, 50, 50); - resized(50, 50, why); -} + TestHelpers.resized(50, 50, why); +}; -function shouldnotresize(why) { +TestHelpers.shouldnotresize = function(why) { var handle = $(".ui-resizable-se", dlg()); drag(handle, 50, 50); - resized(0, 0, why); -} - -function broder(el, side){ - return parseInt(el.css('border-' + side + '-width'), 10); -} - -function margin(el, side) { - return parseInt(el.css('margin-' + side), 10); -} + TestHelpers.resized(0, 0, why); +}; (function($) { diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 515bebdc1..38b75a714 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -244,7 +244,7 @@ test("beforeClose", function() { } }); el.dialog('close'); - isOpen('beforeClose callback should prevent dialog from closing'); + TestHelpers.isOpen('beforeClose callback should prevent dialog from closing'); el.remove(); el = $('<div></div>').dialog(); @@ -256,7 +256,7 @@ test("beforeClose", function() { return false; }); el.dialog('close'); - isOpen('beforeClose callback should prevent dialog from closing'); + TestHelpers.isOpen('beforeClose callback should prevent dialog from closing'); el.remove(); el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) { @@ -266,7 +266,7 @@ test("beforeClose", function() { return false; }); el.dialog('close'); - isOpen('dialogbeforeclose event should prevent dialog from closing'); + TestHelpers.isOpen('dialogbeforeclose event should prevent dialog from closing'); el.remove(); }); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index ba0c2bd41..3c80a9bea 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -25,7 +25,7 @@ test("init", function() { ok(true, '.dialog() called on disconnected DOMElement - removed'); el = $('<div></div>').dialog(); - var foo = el.dialog("option", "foo"); + el.dialog("option", "foo"); el.remove(); ok(true, 'arbitrary option getter after init'); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index ba217c6f4..1c823868e 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -9,11 +9,11 @@ test("autoOpen", function() { expect(2); el = $('<div></div>').dialog({ autoOpen: false }); - isNotOpen('.dialog({ autoOpen: false })'); + TestHelpers.isNotOpen('.dialog({ autoOpen: false })'); el.remove(); el = $('<div></div>').dialog({ autoOpen: true }); - isOpen('.dialog({ autoOpen: true })'); + TestHelpers.isOpen('.dialog({ autoOpen: true })'); el.remove(); }); @@ -22,12 +22,12 @@ test("buttons", function() { var btn, i, newButtons, buttons = { - "Ok": function(ev, ui) { + "Ok": function( ev ) { ok(true, "button click fires callback"); equal(this, el[0], "context of callback"); equal(ev.target, btn[0], "event target"); }, - "Cancel": function(ev, ui) { + "Cancel": function( ev ) { ok(true, "button click fires callback"); equal(this, el[0], "context of callback"); equal(ev.target, btn[1], "event target"); @@ -39,7 +39,7 @@ test("buttons", function() { equal(btn.length, 2, "number of buttons"); i = 0; - $.each(buttons, function(key, val) { + $.each(buttons, function( key ) { equal(btn.eq(i).text(), key, "text of button " + (i+1)); i++; }); @@ -50,7 +50,7 @@ test("buttons", function() { btn.trigger("click"); newButtons = { - "Close": function(ev, ui) { + "Close": function( ev ) { ok(true, "button click fires callback"); equal(this, el[0], "context of callback"); equal(ev.target, btn[0], "event target"); @@ -66,7 +66,7 @@ test("buttons", function() { btn.trigger('click'); i = 0; - $.each(newButtons, function(key, val) { + $.each(newButtons, function( key ) { equal(btn.eq(i).text(), key, "text of button " + (i+1)); i += 1; }); @@ -166,15 +166,15 @@ test("draggable", function() { expect(4); el = $('<div></div>').dialog({ draggable: false }); - shouldnotmove(); + TestHelpers.shouldnotmove(); el.dialog('option', 'draggable', true); - shouldmove(); + TestHelpers.shouldmove(); el.remove(); el = $('<div></div>').dialog({ draggable: true }); - shouldmove(); + TestHelpers.shouldmove(); el.dialog('option', 'draggable', false); - shouldnotmove(); + TestHelpers.shouldnotmove(); el.remove(); }); @@ -395,15 +395,15 @@ test("resizable", function() { expect(4); el = $('<div></div>').dialog(); - shouldresize("[default]"); + TestHelpers.shouldresize("[default]"); el.dialog('option', 'resizable', false); - shouldnotresize('disabled after init'); + TestHelpers.shouldnotresize('disabled after init'); el.remove(); el = $('<div></div>').dialog({ resizable: false }); - shouldnotresize("disabled in init options"); + TestHelpers.shouldnotresize("disabled in init options"); el.dialog('option', 'resizable', true); - shouldresize('enabled after init'); + TestHelpers.shouldresize('enabled after init'); el.remove(); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index e17d55a15..cf4ab0219 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -39,18 +39,18 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { var i; el = $('<div></div>').dialog({ resizable: false }); - shouldnotresize("[default]"); + TestHelpers.shouldnotresize("[default]"); for (i=0; i<2; i++) { el.dialog('close').dialog('open'); - shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); + TestHelpers.shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); } el.remove(); el = $('<div></div>').dialog({ resizable: true }); - shouldresize("[default]"); + TestHelpers.shouldresize("[default]"); for (i=0; i<2; i++) { el.dialog('close').dialog('option', 'resizable', false).dialog('open'); - shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); + TestHelpers.shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); } el.remove(); |