jquery-ui/tests/unit/dialog/deprecated.js

32 lines
1005 B
JavaScript
Raw Normal View History

define( [
2016-04-03 16:10:09 +00:00
"qunit",
"jquery",
"ui/widgets/dialog"
2016-04-03 16:10:09 +00:00
], function( QUnit, $ ) {
2016-04-03 16:10:09 +00:00
QUnit.module( "dialog (deprecated): options" );
2016-04-03 16:10:09 +00:00
QUnit.test( "dialogClass", function( assert ) {
assert.expect( 5 );
var element = $( "<div>" ).dialog(),
widget = element.dialog( "widget" );
assert.lacksClasses( widget, "foo", "dialogClass not specified. class not added" );
element.remove();
2015-08-24 12:59:54 +00:00
element = $( "<div>" ).dialog( { dialogClass: "foo" } );
widget = element.dialog( "widget" );
assert.hasClasses( widget, "foo", "dialogClass in init, foo class added" );
element.dialog( "option", "dialogClass", "foobar" );
assert.lacksClasses( widget, "foo", "dialogClass changed, previous one was removed" );
assert.hasClasses( widget, "foobar", "dialogClass changed, new one was added" );
element.remove();
2015-08-24 12:59:54 +00:00
element = $( "<div>" ).dialog( { dialogClass: "foo bar" } );
widget = element.dialog( "widget" );
assert.hasClasses( widget, "foo bar", "dialogClass in init, two classes." );
element.remove();
2015-08-24 12:59:54 +00:00
} );
} );