diff options
author | Felix Nagel <info@felixnagel.com> | 2012-11-28 23:29:15 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-11-28 23:29:15 +0100 |
commit | 36533a718da41d4dc82286d2b7ff52a34481dbbb (patch) | |
tree | 481804cc832f9b8223fd243de8f6ca8dbd119fa2 /tests/unit/dialog/dialog_methods.js | |
parent | 4e68c526ab464facc56e5b85ca67f4c6648d2f21 (diff) | |
parent | 37ea7341823e7dfe54f37596b1d054b8a2e5c3de (diff) | |
download | jquery-ui-36533a718da41d4dc82286d2b7ff52a34481dbbb.tar.gz jquery-ui-36533a718da41d4dc82286d2b7ff52a34481dbbb.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/unit/dialog/dialog_methods.js')
-rw-r--r-- | tests/unit/dialog/dialog_methods.js | 57 |
1 files changed, 17 insertions, 40 deletions
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 7048a76a9..e5275c7a4 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -34,48 +34,25 @@ test("init", function() { }); test("destroy", function() { - expect( 4 ); - - $("<div></div>").appendTo('body').dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on element'); - - $([]).dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on empty collection'); - - $('<div></div>').dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on disconnected DOMElement'); - - var expected = $('<div></div>').dialog(), - actual = expected.dialog('destroy'); - equal(actual, expected, 'destroy is chainable'); -}); - -test("enable", function() { - expect( 3 ); - - var el, - expected = $('<div></div>').dialog(), - actual = expected.dialog('enable'); - equal(actual, expected, 'enable is chainable'); - - el = $('<div></div>').dialog({ disabled: true }); - el.dialog('enable'); - equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); - ok(!el.dialog('widget').hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); + expect( 6 ); + domEqual( "#dialog1", function() { + var dialog = $( "#dialog1" ).dialog().dialog( "destroy" ); + equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); + equal( dialog.index(), 0 ); + }); + domEqual( "#form-dialog", function() { + var dialog = $( "#form-dialog" ).dialog().dialog( "destroy" ); + equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] ); + equal( dialog.index(), 2 ); + }); }); -test("disable", function() { - expect( 3 ); - - var el, - expected = $('<div></div>').dialog(), - actual = expected.dialog('disable'); - equal(actual, expected, 'disable is chainable'); - - el = $('<div></div>').dialog({ disabled: false }); - el.dialog('disable'); - equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); - ok(el.dialog('widget').hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); +test( "enable/disable disabled", function() { + expect( 2 ); + var el = $( "<div></div>" ).dialog(); + el.dialog( "disable" ); + equal(el.dialog( "option", "disabled" ), false, "disable method doesn't do anything" ); + ok( !el.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" ); }); test("close", function() { |