aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMike Sherov <mike.sherov@gmail.com>2014-08-24 07:19:38 -0400
committerMike Sherov <mike.sherov@gmail.com>2014-08-24 07:19:38 -0400
commitc7bec85cfa7711bb2612278eb980d0d14dade3b9 (patch)
tree4f53b6fe1202f2d9f69a10e77b008fb1cba8b7fd /tests
parentdf7e32fe3798562ffb86d064444f1e0cc8ac59a8 (diff)
downloadjquery-ui-c7bec85cfa7711bb2612278eb980d0d14dade3b9.tar.gz
jquery-ui-c7bec85cfa7711bb2612278eb980d0d14dade3b9.zip
Draggable: append divs to iframe parent for iframefix
This allows the blocking div to move with the iframe in most situations, whereas appending to the body wouldn't. Fixes #9671
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/draggable/draggable_options.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js
index f724decbc..46b80608c 100644
--- a/tests/unit/draggable/draggable_options.js
+++ b/tests/unit/draggable/draggable_options.js
@@ -1334,4 +1334,46 @@ test( "zIndex, default, switching after initialization", function() {
});
+test( "iframeFix", function() {
+ expect( 5 );
+
+ var element = $( "<div>" ).appendTo( "#qunit-fixture" ).draggable({ iframeFix: true }),
+ element2 = $( "<div>" ).appendTo( "#qunit-fixture" ).draggable({ iframeFix: ".iframe" }),
+ iframe = $( "<iframe>" ).appendTo( element );
+
+ element2
+ .append( "<iframe class='iframe'></iframe>" )
+ .append( "<iframe>" );
+
+ iframe.css({
+ width: 1,
+ height: 1
+ });
+
+ element.one( "drag", function() {
+ var div = $( this ).children().not( "iframe" );
+ // http://bugs.jqueryui.com/ticket/9671
+ // iframeFix doesn't handle iframes that move
+ equal( div.length, 1, "blocking div added as sibling" );
+ equal( div.outerWidth(), iframe.outerWidth(), "blocking div is wide enough" );
+ equal( div.outerHeight(), iframe.outerHeight(), "blocking div is tall enough" );
+ deepEqual( div.offset(), iframe.offset(), "blocking div is tall enough" );
+ });
+
+ element.simulate( "drag", {
+ dx: 1,
+ dy: 1
+ });
+
+ element2.one( "drag", function() {
+ var div = $( this ).children().not( "iframe" );
+ equal( div.length, 1, "blocking div added as sibling only to matching selector" );
+ });
+
+ element2.simulate( "drag", {
+ dx: 1,
+ dy: 1
+ });
+});
+
})( jQuery );