]> source.dussan.org Git - jquery-ui.git/commitdiff
Droppable: Use new has/lacksClasses assertions for all class checks
authorAlexander Schmitz <arschmitz@gmail.com>
Fri, 30 Jan 2015 14:57:56 +0000 (09:57 -0500)
committerAlexander Schmitz <arschmitz@gmail.com>
Wed, 11 Mar 2015 20:05:39 +0000 (16:05 -0400)
tests/unit/droppable/droppable.html
tests/unit/droppable/droppable_events.js
tests/unit/droppable/droppable_methods.js
tests/unit/droppable/droppable_options.js

index 52dc3d543daa380fd7b5aa5800d944f88fdb6d80..4fc712a009a05701c75d745650604f94f70377c1 100644 (file)
@@ -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" ],
index 0e1424245be35ffb5efc076f092ce82ef01d6aad..1b205bc973674804566b3a07c48c5a41d20f9366 100644 (file)
@@ -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
index a8a2a078c2e254824884b744b2e6444b8b9720ce..aebaf490c71889453bc511f0de7606e701c7e319 100644 (file)
@@ -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();
 
index 047858abf11ee965da96c33af800a1b76f2d23e0..9a4be076d17f08a1c2688b408fb421c0f0191e19 100644 (file)
@@ -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" );
 });