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" );
});
});
});
-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
equal( actual, expected, "enable is chainable" );
});
-test( "disable", function() {
+test( "disable", function( assert ) {
expect( 14 );
element = $( "#draggable2" ).draggable({ disabled: false });
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" );