Skip to content

Adding support for containment #1988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unittest for #1988
  • Loading branch information
fglueck authored Dec 6, 2021
commit b0aafb4deb1d1edd7f92855d65739b27759b8f06
15 changes: 15 additions & 0 deletions tests/unit/dialog/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,19 @@ QUnit.test( "Open followed by close during show effect", function( assert ) {
}, 100 );
} );

QUnit.test( "Dialog can't break out containment", function( assert ) {
assert.expect( 1 );
var box = $( '<div id="xxx"></div>' ).css( {
height: '500px',border: '0px, margin:'0px', width:'500px', position: 'absolute', bottom: '0px', right: '0px', left: '50px', top: '50px'
} ).appendTo( "body" ),
element = $('<div>X</div>').dialog({containment: box, position: { at: "left top", of: box}}), // open on left top corner
dlg = element.dialog('widget'),
offsetAfter,
expected = box.offset();

testHelper.drag( element, '.ui-dialog-titlebar', -200, -200); // try to move out
offsetAfter = dlg.offset(); // should be the same
assert.deepEqual( offsetAfter, expected, "compare offset" );
} );

} );