diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-11-03 16:17:16 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2012-11-03 16:17:16 -0400 |
commit | 3df9ea29e644a3dd6345161513dae5823d9b0460 (patch) | |
tree | 08bdc053f90d110cb4af39c4de464d92ad8142c6 /tests/unit/sortable | |
parent | 68ad80c2922daccba773a9adafe9fb5efcb129a2 (diff) | |
download | jquery-ui-3df9ea29e644a3dd6345161513dae5823d9b0460.tar.gz jquery-ui-3df9ea29e644a3dd6345161513dae5823d9b0460.zip |
Dev: remove globals from tests and moved test helpers to correct location - Fixed #8770 Dev: Remove globals and Standardize Test Suite
Diffstat (limited to 'tests/unit/sortable')
-rw-r--r-- | tests/unit/sortable/sortable.html | 1 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_core.js | 18 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_methods.js | 14 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_test_helpers.js | 9 | ||||
-rw-r--r-- | tests/unit/sortable/sortable_tickets.js | 12 |
5 files changed, 27 insertions, 27 deletions
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index 644b931ee..b7b7b0007 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -26,6 +26,7 @@ <script src="sortable_events.js"></script> <script src="sortable_methods.js"></script> <script src="sortable_options.js"></script> + <script src="sortable_test_helpers.js"></script> <script src="sortable_tickets.js"></script> <script src="../swarminject.js"></script> diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js index f036121b8..211f8ac95 100644 --- a/tests/unit/sortable/sortable_core.js +++ b/tests/unit/sortable/sortable_core.js @@ -1,19 +1,3 @@ /* * sortable_core.js - */ - -(function($) { - -TestHelpers.sortable = { - sort: function(handle, dx, dy, index, msg) { - $(handle).simulate("drag", { - dx: dx || 0, - dy: dy || 0 - }); - equal($(handle).parent().children().index(handle), index, msg); - } -}; - -module("sortable: core"); - -})(jQuery); + */
\ No newline at end of file diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index 85b418ac8..de32e2f5d 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -42,6 +42,9 @@ test("destroy", function() { test("enable", function() { expect(5); + + var el, actual, expected; + el = $("#sortable").sortable({ disabled: true }); TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable({ disabled: true })'); @@ -56,13 +59,16 @@ test("enable", function() { TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable("option", "disabled", false)'); - var expected = $('<div></div>').sortable(), - actual = expected.sortable('enable'); + expected = $('<div></div>').sortable(), + actual = expected.sortable('enable'); equal(actual, expected, 'enable is chainable'); }); test("disable", function() { expect(7); + + var el, actual, expected; + el = $("#sortable").sortable({ disabled: false }); TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, '.sortable({ disabled: false })'); @@ -78,8 +84,8 @@ test("disable", function() { ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction"); TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, '.sortable("option", "disabled", true)'); - var expected = $('<div></div>').sortable(), - actual = expected.sortable('disable'); + expected = $('<div></div>').sortable(), + actual = expected.sortable('disable'); equal(actual, expected, 'disable is chainable'); }); diff --git a/tests/unit/sortable/sortable_test_helpers.js b/tests/unit/sortable/sortable_test_helpers.js new file mode 100644 index 000000000..7569b5797 --- /dev/null +++ b/tests/unit/sortable/sortable_test_helpers.js @@ -0,0 +1,9 @@ +TestHelpers.sortable = { + sort: function(handle, dx, dy, index, msg) { + $(handle).simulate("drag", { + dx: dx || 0, + dy: dy || 0 + }); + equal($(handle).parent().children().index(handle), index, msg); + } +};
\ No newline at end of file diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js index c8ec08502..eebd8dc21 100644 --- a/tests/unit/sortable/sortable_tickets.js +++ b/tests/unit/sortable/sortable_tickets.js @@ -8,12 +8,12 @@ module("sortable: tickets"); test("#3019: Stop fires too early", function() { expect(2); - var helper = null; - el = $("#sortable").sortable({ - stop: function(event, ui) { - helper = ui.helper; - } - }); + var helper = null, + el = $("#sortable").sortable({ + stop: function(event, ui) { + helper = ui.helper; + } + }); TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable'); equal(helper, null, "helper should be false"); |