aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/droppable
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-01-30 09:57:56 -0500
committerAlexander Schmitz <arschmitz@gmail.com>2015-03-11 16:05:39 -0400
commit15a9ed77083523e6ba1beb92538ebf31f142f000 (patch)
tree974ca8cb9edc659bb5c02095b1037e63b0bb9559 /tests/unit/droppable
parent2d5857ca9e4bfc8b275dedf1dede6f3e0b732632 (diff)
downloadjquery-ui-15a9ed77083523e6ba1beb92538ebf31f142f000.tar.gz
jquery-ui-15a9ed77083523e6ba1beb92538ebf31f142f000.zip
Droppable: Use new has/lacksClasses assertions for all class checks
Diffstat (limited to 'tests/unit/droppable')
-rw-r--r--tests/unit/droppable/droppable.html1
-rw-r--r--tests/unit/droppable/droppable_events.js4
-rw-r--r--tests/unit/droppable/droppable_methods.js6
-rw-r--r--tests/unit/droppable/droppable_options.js9
4 files changed, 11 insertions, 9 deletions
diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html
index 52dc3d543..4fc712a00 100644
--- a/tests/unit/droppable/droppable.html
+++ b/tests/unit/droppable/droppable.html
@@ -12,6 +12,7 @@
<script src="../../../external/qunit/qunit.js"></script>
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
<script src="../testsuite.js"></script>
+ <script src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
<script>
TestHelpers.loadResources({
css: [ "core" ],
diff --git a/tests/unit/droppable/droppable_events.js b/tests/unit/droppable/droppable_events.js
index 0e1424245..1b205bc97 100644
--- a/tests/unit/droppable/droppable_events.js
+++ b/tests/unit/droppable/droppable_events.js
@@ -2,7 +2,7 @@
module( "droppable: events" );
-test( "droppable destruction/recreation on drop event", function() {
+test( "droppable destruction/recreation on drop event", function( assert ) {
expect( 1 );
var config = {
@@ -32,7 +32,7 @@ test( "droppable destruction/recreation on drop event", function() {
dy: dy
});
- ok( !droppable2.hasClass( "active" ), "subsequent droppable no longer active" );
+ assert.lacksClasses( droppable2, "active", "subsequent droppable no longer active" );
});
// todo: comment the following in when ready to actually test
diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js
index a8a2a078c..aebaf490c 100644
--- a/tests/unit/droppable/droppable_methods.js
+++ b/tests/unit/droppable/droppable_methods.js
@@ -63,7 +63,7 @@ test("enable", function() {
equal(actual, expected, "enable is chainable");
});
-test( "disable", function() {
+test( "disable", function( assert ) {
expect( 10 );
var actual, expected,
@@ -77,9 +77,9 @@ test( "disable", function() {
element.droppable({ disabled: false });
TestHelpers.droppable.shouldDrop();
element.droppable( "option", "disabled", true );
- ok( !element.droppable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ assert.lacksClasses( element.droppable( "widget" ), "ui-state-disabled" );
ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
- ok( element.droppable( "widget" ).hasClass( "ui-droppable-disabled" ), "element gets ui-droppable-disabled" );
+ assert.hasClasses( element.droppable( "widget" ), "ui-droppable-disabled" );
equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
TestHelpers.droppable.shouldNotDrop();
diff --git a/tests/unit/droppable/droppable_options.js b/tests/unit/droppable/droppable_options.js
index 047858abf..9a4be076d 100644
--- a/tests/unit/droppable/droppable_options.js
+++ b/tests/unit/droppable/droppable_options.js
@@ -22,17 +22,18 @@ test( "activeClass", function() {
ok(false, 'missing test - untested code is broken code');
});
*/
-test( "{ addClasses: true }, default", function() {
+test( "{ addClasses: true }, default", function( assert ) {
expect( 1 );
var el = $( "<div />" ).droppable({ addClasses: true });
- ok( el.is( ".ui-droppable" ), "'ui-droppable' class added" );
+ assert.hasClasses( el, "ui-droppable" );
el.droppable( "destroy" );
});
-test( "{ addClasses: false }", function() {
+test( "{ addClasses: false }", function( assert ) {
expect( 1 );
var el = $( "<div />" ).droppable({ addClasses: false });
- ok( !el.is( ".ui-droppable" ), "'ui-droppable' class not added" );
+
+ assert.lacksClasses( el, "ui-droppable" );
el.droppable( "destroy" );
});