Skip to content

Commit b0aafb4

Browse files
authored
Unittest for jquery#1988
1 parent 73dd781 commit b0aafb4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/dialog/options.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,4 +569,19 @@ QUnit.test( "Open followed by close during show effect", function( assert ) {
569569
}, 100 );
570570
} );
571571

572+
QUnit.test( "Dialog can't break out containment", function( assert ) {
573+
assert.expect( 1 );
574+
var box = $( '<div id="xxx"></div>' ).css( {
575+
height: '500px',border: '0px, margin:'0px', width:'500px', position: 'absolute', bottom: '0px', right: '0px', left: '50px', top: '50px'
576+
} ).appendTo( "body" ),
577+
element = $('<div>X</div>').dialog({containment: box, position: { at: "left top", of: box}}), // open on left top corner
578+
dlg = element.dialog('widget'),
579+
offsetAfter,
580+
expected = box.offset();
581+
582+
testHelper.drag( element, '.ui-dialog-titlebar', -200, -200); // try to move out
583+
offsetAfter = dlg.offset(); // should be the same
584+
assert.deepEqual( offsetAfter, expected, "compare offset" );
585+
} );
586+
572587
} );

0 commit comments

Comments
 (0)