From 3df9ea29e644a3dd6345161513dae5823d9b0460 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Sat, 3 Nov 2012 16:17:16 -0400 Subject: Dev: remove globals from tests and moved test helpers to correct location - Fixed #8770 Dev: Remove globals and Standardize Test Suite --- tests/unit/droppable/droppable.html | 1 + tests/unit/droppable/droppable_core.js | 11 ----------- tests/unit/droppable/droppable_methods.js | 14 ++++++++++---- tests/unit/droppable/droppable_options.js | 4 ++-- tests/unit/droppable/droppable_test_helpers.js | 10 ++++++++++ 5 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 tests/unit/droppable/droppable_test_helpers.js (limited to 'tests/unit/droppable') diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index cd29b1cdf..7cd5eb0f5 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -27,6 +27,7 @@ + diff --git a/tests/unit/droppable/droppable_core.js b/tests/unit/droppable/droppable_core.js index 21763bc63..c98850a03 100644 --- a/tests/unit/droppable/droppable_core.js +++ b/tests/unit/droppable/droppable_core.js @@ -2,17 +2,6 @@ * droppable_core.js */ -TestHelpers.droppable = { - shouldDrop: function() { - // todo: actually implement this - ok(true, 'missing test - untested code is broken code'); - }, - shouldNotDrop: function() { - // todo: actually implement this - ok(true, 'missing test - untested code is broken code'); - } -}; - (function($) { module("droppable: core"); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index 3f1293ae4..76501c5b1 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -43,6 +43,9 @@ test("destroy", function() { test("enable", function() { expect(7); + + var el, expected, actual; + el = $("#droppable1").droppable({ disabled: true }); TestHelpers.droppable.shouldNotDrop(); el.droppable("enable"); @@ -55,13 +58,16 @@ test("enable", function() { equal(el.droppable("option", "disabled"), false, "disabled option setter"); TestHelpers.droppable.shouldDrop(); - var expected = $('
').droppable(), - actual = expected.droppable('enable'); + expected = $('
').droppable(), + actual = expected.droppable('enable'); equal(actual, expected, 'enable is chainable'); }); test("disable", function() { expect(7); + + var el, actual, expected; + el = $("#droppable1").droppable({ disabled: false }); TestHelpers.droppable.shouldDrop(); el.droppable("disable"); @@ -74,8 +80,8 @@ test("disable", function() { equal(el.droppable("option", "disabled"), true, "disabled option setter"); TestHelpers.droppable.shouldNotDrop(); - var expected = $('
').droppable(), - actual = expected.droppable('disable'); + expected = $('
').droppable(), + actual = expected.droppable('disable'); equal(actual, expected, 'disable is chainable'); }); diff --git a/tests/unit/droppable/droppable_options.js b/tests/unit/droppable/droppable_options.js index db3201e88..c2ecdcfda 100644 --- a/tests/unit/droppable/droppable_options.js +++ b/tests/unit/droppable/droppable_options.js @@ -24,14 +24,14 @@ test("activeClass", function() { */ test("{ addClasses: true }, default", function() { expect( 1 ); - el = $("
").droppable({ addClasses: true }); + var el = $("
").droppable({ addClasses: true }); ok(el.is(".ui-droppable"), "'ui-droppable' class added"); el.droppable("destroy"); }); test("{ addClasses: false }", function() { expect( 1 ); - el = $("
").droppable({ addClasses: false }); + var el = $("
").droppable({ addClasses: false }); ok(!el.is(".ui-droppable"), "'ui-droppable' class not added"); el.droppable("destroy"); }); diff --git a/tests/unit/droppable/droppable_test_helpers.js b/tests/unit/droppable/droppable_test_helpers.js new file mode 100644 index 000000000..79311788c --- /dev/null +++ b/tests/unit/droppable/droppable_test_helpers.js @@ -0,0 +1,10 @@ +TestHelpers.droppable = { + shouldDrop: function() { + // todo: actually implement this + ok(true, 'missing test - untested code is broken code'); + }, + shouldNotDrop: function() { + // todo: actually implement this + ok(true, 'missing test - untested code is broken code'); + } +}; \ No newline at end of file -- cgit v1.2.3