Skip to content
Permalink
Browse files

Droppable: Use new has/lacksClasses assertions for all class checks

  • Loading branch information
arschmitz committed Jan 30, 2015
1 parent 2d5857c commit 15a9ed77083523e6ba1beb92538ebf31f142f000
@@ -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" ],
@@ -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
@@ -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();

@@ -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" );
});

0 comments on commit 15a9ed7

Please sign in to comment.
You can’t perform that action at this time.