aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/sortable
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2012-12-07 20:06:29 -0500
committerMike Sherov <mike.sherov@gmail.com>2012-12-07 20:06:29 -0500
commite83a89dd7df3009d46ddd9e7e1cabf42e901e397 (patch)
tree8ada242bd81857ace993ce09625d06236530cc4a /tests/unit/sortable
parentd4551bc3b8dfbfd925700dcb9f71e7729b125889 (diff)
downloadjquery-ui-e83a89dd7df3009d46ddd9e7e1cabf42e901e397.tar.gz
jquery-ui-e83a89dd7df3009d46ddd9e7e1cabf42e901e397.zip
Dev: Remove *_tickets.js test files and move the associated tests to the proper locations.
Diffstat (limited to 'tests/unit/sortable')
-rw-r--r--tests/unit/sortable/sortable_events.js61
-rw-r--r--tests/unit/sortable/sortable_tickets.js69
2 files changed, 61 insertions, 69 deletions
diff --git a/tests/unit/sortable/sortable_events.js b/tests/unit/sortable/sortable_events.js
index 556f539e1..4245d64fa 100644
--- a/tests/unit/sortable/sortable_events.js
+++ b/tests/unit/sortable/sortable_events.js
@@ -128,6 +128,67 @@ test("update", function() {
});
+test("#3019: Stop fires too early", function() {
+ expect(2);
+
+ 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");
+
+});
+
+test('#4752: link event firing on sortable with connect list', function () {
+ expect( 10 );
+
+ var fired = {},
+ hasFired = function (type) { return (type in fired) && (true === fired[type]); };
+
+ $('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');
+
+ $('#qunit-fixture ul').sortable({
+ connectWith: '#qunit-fixture ul',
+ change: function () {
+ fired.change = true;
+ },
+ receive: function () {
+ fired.receive = true;
+ },
+ remove: function () {
+ fired.remove = true;
+ }
+ });
+
+ $('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
+ fired.click = true;
+ });
+
+ $('#sortable li:eq(0)').simulate('click');
+ ok(!hasFired('change'), 'Click only, change event should not have fired');
+ ok(hasFired('click'), 'Click event should have fired');
+
+ // Drag an item within the first list
+ fired = {};
+ $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
+ ok(hasFired('change'), '40px drag, change event should have fired');
+ ok(!hasFired('receive'), 'Receive event should not have fired');
+ ok(!hasFired('remove'), 'Remove event should not have fired');
+ ok(!hasFired('click'), 'Click event should not have fired');
+
+ // Drag an item from the first list to the second, connected list
+ fired = {};
+ $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
+ ok(hasFired('change'), '150px drag, change event should have fired');
+ ok(hasFired('receive'), 'Receive event should have fired');
+ ok(hasFired('remove'), 'Remove event should have fired');
+ ok(!hasFired('click'), 'Click event should not have fired');
+});
+
/*
test("receive", function() {
ok(false, "missing test - untested code is broken code.");
diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js
deleted file mode 100644
index eebd8dc21..000000000
--- a/tests/unit/sortable/sortable_tickets.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * sortable_tickets.js
- */
-(function($) {
-
-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;
- }
- });
-
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, 'Dragging the sortable');
- equal(helper, null, "helper should be false");
-
-});
-
-test('#4752: link event firing on sortable with connect list', function () {
- expect( 10 );
-
- var fired = {},
- hasFired = function (type) { return (type in fired) && (true === fired[type]); };
-
- $('#sortable').clone().attr('id', 'sortable2').insertAfter('#sortable');
-
- $('#qunit-fixture ul').sortable({
- connectWith: '#qunit-fixture ul',
- change: function () {
- fired.change = true;
- },
- receive: function () {
- fired.receive = true;
- },
- remove: function () {
- fired.remove = true;
- }
- });
-
- $('#qunit-fixture ul').bind('click.ui-sortable-test', function () {
- fired.click = true;
- });
-
- $('#sortable li:eq(0)').simulate('click');
- ok(!hasFired('change'), 'Click only, change event should not have fired');
- ok(hasFired('click'), 'Click event should have fired');
-
- // Drag an item within the first list
- fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 40 });
- ok(hasFired('change'), '40px drag, change event should have fired');
- ok(!hasFired('receive'), 'Receive event should not have fired');
- ok(!hasFired('remove'), 'Remove event should not have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
-
- // Drag an item from the first list to the second, connected list
- fired = {};
- $('#sortable li:eq(0)').simulate('drag', { dx: 0, dy: 150 });
- ok(hasFired('change'), '150px drag, change event should have fired');
- ok(hasFired('receive'), 'Receive event should have fired');
- ok(hasFired('remove'), 'Remove event should have fired');
- ok(!hasFired('click'), 'Click event should not have fired');
-});
-
-})(jQuery);