diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-12-08 21:27:37 -0500 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2012-12-08 21:27:37 -0500 |
commit | 9f764467751c1c5bdefa28421807eafc9868b37f (patch) | |
tree | 3f62748637c07900fb5b4b66b9a3d9197bafc456 /tests/unit/selectable | |
parent | 5dee8dee309564626393e1871991aa2a0e58dd74 (diff) | |
download | jquery-ui-9f764467751c1c5bdefa28421807eafc9868b37f.tar.gz jquery-ui-9f764467751c1c5bdefa28421807eafc9868b37f.zip |
Dev: remove unnecessary simulated drag delegation in test suite
Diffstat (limited to 'tests/unit/selectable')
-rw-r--r-- | tests/unit/selectable/selectable_events.js | 30 | ||||
-rw-r--r-- | tests/unit/selectable/selectable_methods.js | 21 | ||||
-rw-r--r-- | tests/unit/selectable/selectable_options.js | 22 | ||||
-rw-r--r-- | tests/unit/selectable/selectable_test_helpers.js | 8 |
4 files changed, 53 insertions, 28 deletions
diff --git a/tests/unit/selectable/selectable_events.js b/tests/unit/selectable/selectable_events.js index 331bae146..984fd1862 100644 --- a/tests/unit/selectable/selectable_events.js +++ b/tests/unit/selectable/selectable_events.js @@ -1,32 +1,38 @@ /* * selectable_events.js */ -(function($) { +(function( $ ) { module("selectable: events"); -test("start", function() { - expect(2); +test( "start", function() { + expect( 2 ); var el = $("#selectable1"); el.selectable({ start: function() { - ok(true, "drag fired start callback"); - equal(this, el[0], "context of callback"); + ok( true, "drag fired start callback" ); + equal( this, el[0], "context of callback" ); } }); - el.simulate("drag", 20, 20); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); }); -test("stop", function() { - expect(2); +test( "stop", function() { + expect( 2 ); var el = $("#selectable1"); el.selectable({ start: function() { - ok(true, "drag fired stop callback"); - equal(this, el[0], "context of callback"); + ok( true, "drag fired stop callback" ); + equal( this, el[0], "context of callback" ); } }); - el.simulate("drag", 20, 20); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); }); -})(jQuery); +})( jQuery ); diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js index aa8924176..d894a13e4 100644 --- a/tests/unit/selectable/selectable_methods.js +++ b/tests/unit/selectable/selectable_methods.js @@ -53,10 +53,16 @@ test("enable", function() { disabled: true, start: function() { fired = true; } }); - el.simulate("drag", 20, 20); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); equal(fired, false, "start fired"); el.selectable("enable"); - el.simulate("drag", 20, 20); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); equal(fired, true, "start fired"); el.selectable("destroy"); @@ -75,11 +81,18 @@ test("disable", function() { disabled: false, start: function() { fired = true; } }); - el.simulate("drag", 20, 20); + el.simulate( "drag", { + dx: 20, + dy: 20 + }); equal(fired, true, "start fired"); el.selectable("disable"); fired = false; - el.simulate("drag", 20, 20); + + el.simulate( "drag", { + dx: 20, + dy: 20 + }); equal(fired, false, "start fired"); el.selectable("destroy"); diff --git a/tests/unit/selectable/selectable_options.js b/tests/unit/selectable/selectable_options.js index 50e047427..a2455fdca 100644 --- a/tests/unit/selectable/selectable_options.js +++ b/tests/unit/selectable/selectable_options.js @@ -15,7 +15,10 @@ test("autoRefresh", function() { el = $("#selectable1").selectable({ autoRefresh: false, selected: selected }); sel.hide(); - TestHelpers.selectable.drag(el, 1000, 1000); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); equal(actual, sel.length); el.selectable("destroy"); @@ -23,11 +26,19 @@ test("autoRefresh", function() { sel.show(); el = $("#selectable1").selectable({ autoRefresh: true, selected: selected }); sel.hide(); - TestHelpers.selectable.drag(el, 1000, 1000); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); equal(actual, 0); + sel.show(); - TestHelpers.selectable.drag( sel[ 0 ], 1000, 1000 ); + $( sel[ 0 ] ).simulate( "drag", { + dx: 1000, + dy: 1000 + }); equal(actual, sel.length); + el.selectable("destroy"); sel.show(); }); @@ -42,7 +53,10 @@ test("filter", function() { el = $("#selectable1").selectable({ filter: '.special', selected: selected }); - TestHelpers.selectable.drag(el, 1000, 1000); + el.simulate( "drag", { + dx: 1000, + dy: 1000 + }); ok(sel.length !== 1, "this test assumes more than 1 selectee"); equal(actual, 1); el.selectable("destroy"); diff --git a/tests/unit/selectable/selectable_test_helpers.js b/tests/unit/selectable/selectable_test_helpers.js deleted file mode 100644 index 6f87efbb3..000000000 --- a/tests/unit/selectable/selectable_test_helpers.js +++ /dev/null @@ -1,8 +0,0 @@ -TestHelpers.selectable = { - drag: function( el, dx, dy ) { - $( el ).simulate( "drag", { - dx: dx || 0, - dy: dy || 0 - }); - } -};
\ No newline at end of file |