diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-01-30 09:57:30 -0500 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-03-11 16:05:39 -0400 |
commit | 2d5857ca9e4bfc8b275dedf1dede6f3e0b732632 (patch) | |
tree | 34f71de39366805919596135c24d5a13ab0030a0 | |
parent | a9fa490418c911ff8a170c5d2e87e5dbc3be3ea3 (diff) | |
download | jquery-ui-2d5857ca9e4bfc8b275dedf1dede6f3e0b732632.tar.gz jquery-ui-2d5857ca9e4bfc8b275dedf1dede6f3e0b732632.zip |
Draggable: Use new has/lacksClasses assertions for all class checks
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 2 | ||||
-rw-r--r-- | tests/unit/draggable/draggable.html | 1 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_core.js | 23 | ||||
-rw-r--r-- | tests/unit/draggable/draggable_methods.js | 6 |
4 files changed, 16 insertions, 16 deletions
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index c012f80a5..c92f1f1b4 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -105,7 +105,7 @@ test( "enable/disable disabled", function( assert ) { var element = $( "<div></div>" ).dialog(); element.dialog( "disable" ); equal(element.dialog( "option", "disabled" ), false, "disable method doesn't do anything" ); - assert.lacksClasses( element, "ui-dialog-disabled ui-state-disabled" ); + assert.lacksClasses( element, "ui-dialog-disabled ui-state-disabled", "disable method doesn't add classes" ); ok( !element.dialog( "widget" ).attr( "aria-disabled" ), "disable method doesn't add aria-disabled" ); }); diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index eb4985adc..a8fdf91ca 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -68,6 +68,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/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index 81c31e22f..8b3895163 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -318,35 +318,34 @@ asyncTest( "blur behavior", function() { }); }); -test( "ui-draggable-handle assigned to appropriate element", function() { +test( "ui-draggable-handle assigned to appropriate element", function( assert ) { expect( 5 ); var p = $( "<p>" ).appendTo( "#qunit-fixture" ), element = $( "<div><p></p></div>" ).appendTo( "#qunit-fixture" ).draggable(); - ok( element.hasClass( "ui-draggable-handle" ), "handle is element by default" ); + assert.hasClasses( element, "ui-draggable-handle" ); element.draggable( "option", "handle", "p" ); - ok( !element.hasClass( "ui-draggable-handle" ), "removed from element" ); - ok( element.find( "p" ).hasClass( "ui-draggable-handle" ), "added to handle" ); - - ok( !p.hasClass( "ui-draggable-handle" ), + assert.lacksClasses( element, "ui-draggable-handle" ); + assert.hasClasses( element.find( "p" ), "ui-draggable-handle", "ensure handle class name is constrained within the draggble (#10212)" ); + assert.lacksClasses( p, "ui-draggable-handle" ); element.draggable( "destroy" ); - ok( !element.find( "p" ).hasClass( "ui-draggable-handle" ), "removed in destroy()" ); + assert.lacksClasses( element.find( "p" ), "ui-draggable-handle" ); }); -test( "ui-draggable-handle managed correctly in nested draggables", function() { +test( "ui-draggable-handle managed correctly in nested draggables", function( assert ) { expect( 4 ); var parent = $( "<div><div></div></div>" ).draggable().appendTo( "#qunit-fixture" ), child = parent.find( "div" ).draggable(); - ok( parent.hasClass( "ui-draggable-handle" ), "parent has class name on init" ); - ok( child.hasClass( "ui-draggable-handle" ), "child has class name on init" ); + assert.hasClasses( parent, "ui-draggable-handle", "parent has class name on init" ); + assert.hasClasses( child, "ui-draggable-handle", "child has class name on init" ); parent.draggable( "destroy" ); - ok( !parent.hasClass( "ui-draggable-handle" ), "parent loses class name on destroy" ); - ok( child.hasClass( "ui-draggable-handle" ), "child retains class name on destroy" ); + assert.lacksClasses( parent, "ui-draggable-handle", "parent loses class name on destroy" ); + assert.hasClasses( child, "ui-draggable-handle", "child retains class name on destroy" ); }); // http://bugs.jqueryui.com/ticket/7772 diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js index 351d57764..210f48964 100644 --- a/tests/unit/draggable/draggable_methods.js +++ b/tests/unit/draggable/draggable_methods.js @@ -73,7 +73,7 @@ test( "enable", function() { equal( actual, expected, "enable is chainable" ); }); -test( "disable", function() { +test( "disable", function( assert ) { expect( 14 ); element = $( "#draggable2" ).draggable({ disabled: false }); @@ -91,9 +91,9 @@ test( "disable", function() { equal( element.draggable( "option", "disabled" ), true, "disabled option setter" ); TestHelpers.draggable.shouldNotDrag( element, ".draggable('option', 'disabled', true)" ); - ok( !element.draggable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" ); + assert.lacksClasses( element.draggable( "widget" ), "ui-state-disabled" ); ok( !element.draggable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" ); - ok( element.draggable( "widget" ).hasClass( "ui-draggable-disabled" ), "element gets ui-draggable-disabled" ); + assert.hasClasses( element.draggable( "widget" ), "ui-draggable-disabled" ); var expected = element.draggable(), actual = expected.draggable( "disable" ); |