diff options
author | David Sullivan <david.sullivan@gmail.com> | 2013-01-26 04:03:14 -0600 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2013-01-26 11:34:51 -0500 |
commit | 55360eeb7eae5c560d51b09178e64d83c59223a6 (patch) | |
tree | 97a342e0e4436c0c0b6ef4b3b2ac473ea0da8f48 /tests/unit/dialog | |
parent | c53198c2099d25e80887c86af6d0e624414cc2f7 (diff) | |
download | jquery-ui-55360eeb7eae5c560d51b09178e64d83c59223a6.tar.gz jquery-ui-55360eeb7eae5c560d51b09178e64d83c59223a6.zip |
Dialog: modified _createOverlay to _appendTo instead of document.body. Fixed #8984 - Modal dialogs display behind overlay when using appendTo option
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r-- | tests/unit/dialog/dialog_options.js | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index a20480de6..5f0434308 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -6,43 +6,63 @@ module("dialog: options"); test( "appendTo", function() { - expect( 8 ); + expect( 16 ); var detached = $( "<div>" ), - element = $( "#dialog1" ).dialog(); + element = $( "#dialog1" ).dialog({ + modal: true + }); equal( element.dialog( "widget" ).parent()[0], document.body, "defaults to body" ); + equal( $( ".ui-widget-overlay" ).parent()[0], document.body, "overlay defaults to body" ); element.dialog( "destroy" ); element.dialog({ - appendTo: ".wrap" + appendTo: ".wrap", + modal: true }); equal( element.dialog( "widget" ).parent()[0], $( "#wrap1" )[0], "first found element" ); + equal( $( ".ui-widget-overlay" ).parent()[0], $( "#wrap1" )[0], "overlay first found element" ); equal( $( "#wrap2 .ui-dialog" ).length, 0, "only appends to one element" ); + equal( $( "#wrap2 .ui-widget-overlay" ).length, 0, "overlay only appends to one element" ); element.dialog( "destroy" ); element.dialog({ - appendTo: null + appendTo: null, + modal: true }); equal( element.dialog( "widget" ).parent()[0], document.body, "null" ); + equal( $( ".ui-widget-overlay" ).parent()[0], document.body, "overlay null" ); element.dialog( "destroy" ); - element.dialog({ autoOpen: false }).dialog( "option", "appendTo", "#wrap1" ).dialog( "open" ); + element.dialog({ + autoOpen: false, + modal: true + }).dialog( "option", "appendTo", "#wrap1" ).dialog( "open" ); equal( element.dialog( "widget" ).parent()[0], $( "#wrap1" )[0], "modified after init" ); + equal( $( ".ui-widget-overlay" ).parent()[0], $( "#wrap1" )[0], "overlay modified after init" ); element.dialog( "destroy" ); element.dialog({ - appendTo: detached + appendTo: detached, + modal: true }); equal( element.dialog( "widget" ).parent()[0], detached[0], "detached jQuery object" ); + equal( detached.find( ".ui-widget-overlay" ).parent()[0], detached[0], "overlay detached jQuery object" ); element.dialog( "destroy" ); element.dialog({ - appendTo: detached[0] + appendTo: detached[0], + modal: true }); equal( element.dialog( "widget" ).parent()[0], detached[0], "detached DOM element" ); + equal( detached.find( ".ui-widget-overlay" ).parent()[0], detached[0], "overlay detached DOM element" ); element.dialog( "destroy" ); - element.dialog({ autoOpen: false }).dialog( "option", "appendTo", detached ); + element.dialog({ + autoOpen: false, + modal: true + }).dialog( "option", "appendTo", detached ); equal( element.dialog( "widget" ).parent()[0], detached[0], "detached DOM element via option()" ); + equal( detached.find( ".ui-widget-overlay" ).length, 0, "overlay detached DOM element via option()" ); element.dialog( "destroy" ); }); |