From b694409e76181dbfdfec9419d9c3f688ff183a53 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 16 Nov 2012 19:33:55 +0100 Subject: Dialog: Extend visual test to verify DOM position restore on destroy; overhaul unit test for destroy method. --- tests/unit/dialog/dialog.html | 11 +++++++++++ tests/unit/dialog/dialog_methods.js | 25 +++++++++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 0022b42cf..0b5ca4856 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -45,6 +45,17 @@
+
+
+ Please share some personal information + + +
+
+

Some more (optional) information

+ +
+
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index 7048a76a9..a4959bf85 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -34,20 +34,17 @@ test("init", function() { }); test("destroy", function() { - expect( 4 ); - - $("
").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'); - - $('
').dialog().dialog("destroy").remove(); - ok(true, '.dialog("destroy") called on disconnected DOMElement'); - - var expected = $('
').dialog(), - actual = expected.dialog('destroy'); - equal(actual, expected, 'destroy is chainable'); + 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("enable", function() { -- cgit v1.2.3