From c7361062d0ef8901249eba03729dc6713495b473 Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Fri, 6 Feb 2009 02:41:46 +0000 Subject: [PATCH] sortable unit tests - fixed el.css not a function --- tests/unit/sortable/sortable_core.js | 20 -------------------- tests/unit/sortable/sortable_methods.js | 17 +++++++++++++++++ tests/unit/sortable/sortable_tickets.js | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/tests/unit/sortable/sortable_core.js b/tests/unit/sortable/sortable_core.js index ecc120398..ff1859874 100644 --- a/tests/unit/sortable/sortable_core.js +++ b/tests/unit/sortable/sortable_core.js @@ -2,26 +2,6 @@ * sortable_core.js */ -var el, offsetBefore, offsetAfter, dragged; - -var drag = function(handle, dx, dy) { - offsetBefore = $(handle).offset(); - $(handle).simulate("drag", { - dx: dx || 0, - dy: dy || 0 - }); - dragged = { dx: dx, dy: dy }; - offsetAfter = $(handle).offset(); -} - -var sort = function(handle, dx, dy, index, msg) { - drag(handle, dx, dy); - equals($(handle).parent().children().index(handle), index, msg); -} - -var border = function(el, side) { return parseInt(el.css('border-' + side + '-width')); } -var margin = function(el, side) { return parseInt(el.css('margin-' + side)); } - (function($) { module("sortable: core"); diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index 7e1fd2c90..e19ccc58f 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -3,6 +3,23 @@ */ (function($) { +var el, offsetBefore, offsetAfter, dragged; + +var drag = function(handle, dx, dy) { + offsetBefore = $(handle).offset(); + $(handle).simulate("drag", { + dx: dx || 0, + dy: dy || 0 + }); + dragged = { dx: dx, dy: dy }; + offsetAfter = $(handle).offset(); +} + +var sort = function(handle, dx, dy, index, msg) { + drag(handle, dx, dy); + equals($(handle).parent().children().index(handle), index, msg); +} + module("sortable: methods"); test("init", function() { diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js index 53ef62ae9..e265c2f3a 100644 --- a/tests/unit/sortable/sortable_tickets.js +++ b/tests/unit/sortable/sortable_tickets.js @@ -3,6 +3,23 @@ */ (function($) { +var el, offsetBefore, offsetAfter, dragged; + +var drag = function(handle, dx, dy) { + offsetBefore = $(handle).offset(); + $(handle).simulate("drag", { + dx: dx || 0, + dy: dy || 0 + }); + dragged = { dx: dx, dy: dy }; + offsetAfter = $(handle).offset(); +} + +var sort = function(handle, dx, dy, index, msg) { + drag(handle, dx, dy); + equals($(handle).parent().children().index(handle), index, msg); +} + module("sortable: tickets"); test("#3019: Stop fires too early", function() { -- 2.39.5