aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/jquery.simulate.js2
-rw-r--r--tests/unit/draggable/draggable_core.js16
-rw-r--r--tests/unit/droppable/droppable_methods.js31
-rw-r--r--tests/unit/widget/widget_core.js10
4 files changed, 57 insertions, 2 deletions
diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js
index 0a0c42487..1dd96ac3a 100644
--- a/tests/jquery.simulate.js
+++ b/tests/jquery.simulate.js
@@ -313,7 +313,7 @@ $.extend( $.simulate.prototype, {
clientY: Math.round( y )
};
- this.simulateEvent( document, "mousemove", coord );
+ this.simulateEvent( target.ownerDocument, "mousemove", coord );
}
if ( $.contains( document, target ) ) {
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js
index e7fcdfa87..e2dc2a481 100644
--- a/tests/unit/draggable/draggable_core.js
+++ b/tests/unit/draggable/draggable_core.js
@@ -169,4 +169,20 @@ test( "#5009: scroll not working with parent's position fixed", function() {
});
});
+test( "#5727: draggable from iframe" , function() {
+ expect( 2 );
+
+ var iframe = $( "<iframe id='iframe-draggable-container' src='about:blank'></iframe>" ).appendTo( "#qunit-fixture" ),
+ iframeBody = iframe.contents().find( "body" ).append(
+ "<div id='iframe-draggable-1' style='background: green; width: 200px; height: 100px;'>Relative</div>"
+ ),
+ draggable1 = iframeBody.find( "#iframe-draggable-1" );
+
+ draggable1.draggable();
+
+ equal( draggable1.closest( iframeBody ).length, 1 );
+
+ TestHelpers.draggable.shouldMove( draggable1 );
+});
+
})( jQuery );
diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js
index f7682d262..ce3d8f72f 100644
--- a/tests/unit/droppable/droppable_methods.js
+++ b/tests/unit/droppable/droppable_methods.js
@@ -88,4 +88,33 @@ test( "disable", function() {
equal( actual, expected, "disable is chainable" );
});
-})(jQuery);
+test( "intersect", function() {
+ expect( 8 );
+
+ var actual, data,
+ draggable = $( "<div />" ).appendTo( "#qunit-fixture" ).css({ width: 10, height: 10, position: "absolute" }).draggable(),
+ droppable = $( "<div />" ).appendTo( "#qunit-fixture" ).css({ width: 10, height: 10, position: "absolute", top: 5, left: 5 }).droppable(),
+ dataset = [
+ [ -1, -1, false, "too far up and left" ],
+ [ -1, 0, false, "too far left" ],
+ [ 0, -1, false, "too far up" ],
+ [ 0, 0, true, "top left corner" ],
+ [ 9, 9, true, "bottom right corner" ],
+ [ 10, 9, false, "too far right" ],
+ [ 9, 10, false, "too far down" ],
+ [ 10, 10, false, "too far down and right" ]
+ ],
+ x = 0;
+
+ for ( ; x < dataset.length; x++ ) {
+ data = dataset[ x ];
+ $( draggable ).simulate( "drag", {
+ dx: ( data[ 0 ] - $( draggable ).position().left ),
+ dy: ( data[ 1 ] - $( draggable ).position().top )
+ });
+ actual = $.ui.intersect( $( draggable ).draggable( "instance" ), $( droppable ).droppable( "instance" ), "pointer" );
+ equal( actual, data[ 2 ], data[ 3 ] );
+ }
+});
+
+})( jQuery );
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 0d97742ff..3268b756d 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -331,6 +331,16 @@ test( "re-init", function() {
deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
});
+test( "redeclare", function() {
+ expect( 2 );
+
+ $.widget( "ui.testWidget", {} );
+ equal( $.ui.testWidget.prototype.widgetEventPrefix, "testWidget" );
+
+ $.widget( "ui.testWidget", {} );
+ equal( $.ui.testWidget.prototype.widgetEventPrefix, "testWidget" );
+});
+
test( "inheritance", function() {
expect( 6 );
// #5830 - Widget: Using inheritance overwrites the base classes options