2015-04-07 00:35:27 +00:00
|
|
|
define( [
|
2016-04-03 16:32:14 +00:00
|
|
|
"qunit",
|
2015-04-07 00:35:27 +00:00
|
|
|
"jquery",
|
2020-05-16 07:16:24 +00:00
|
|
|
"lib/helper",
|
2015-07-15 02:03:06 +00:00
|
|
|
"ui/widgets/droppable"
|
2020-05-16 07:16:24 +00:00
|
|
|
], function( QUnit, $, helper ) {
|
2021-06-06 22:58:12 +00:00
|
|
|
"use strict";
|
2009-02-02 07:09:15 +00:00
|
|
|
|
2020-05-16 07:16:24 +00:00
|
|
|
QUnit.module( "droppable: events", { afterEach: helper.moduleAfterEach } );
|
2009-02-02 07:09:15 +00:00
|
|
|
|
2016-04-03 16:32:14 +00:00
|
|
|
QUnit.test( "droppable destruction/recreation on drop event", function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2013-02-24 05:55:29 +00:00
|
|
|
|
|
|
|
var config = {
|
|
|
|
activeClass: "active",
|
|
|
|
drop: function() {
|
|
|
|
var element = $( this ),
|
|
|
|
newDroppable = $( "<div>" )
|
2015-08-24 12:59:32 +00:00
|
|
|
.css( { width: 100, height: 100 } )
|
2013-02-24 05:55:29 +00:00
|
|
|
.text( "Droppable" );
|
|
|
|
element.after( newDroppable );
|
|
|
|
element.remove();
|
|
|
|
newDroppable.droppable( config );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
draggable = $( "#draggable1" ).draggable(),
|
|
|
|
droppable1 = $( "#droppable1" ).droppable( config ),
|
|
|
|
droppable2 = $( "#droppable2" ).droppable( config ),
|
|
|
|
|
|
|
|
droppableOffset = droppable1.offset(),
|
|
|
|
draggableOffset = draggable.offset(),
|
|
|
|
dx = droppableOffset.left - draggableOffset.left,
|
|
|
|
dy = droppableOffset.top - draggableOffset.top;
|
|
|
|
|
|
|
|
draggable.simulate( "drag", {
|
|
|
|
dx: dx,
|
|
|
|
dy: dy
|
2015-08-24 12:59:32 +00:00
|
|
|
} );
|
2013-02-24 05:55:29 +00:00
|
|
|
|
2015-01-30 14:57:56 +00:00
|
|
|
assert.lacksClasses( droppable2, "active", "subsequent droppable no longer active" );
|
2015-08-24 12:59:32 +00:00
|
|
|
} );
|
2013-02-24 05:55:29 +00:00
|
|
|
|
2016-04-03 16:32:14 +00:00
|
|
|
// Todo: comment the following in when ready to actually test
|
2012-10-31 02:19:49 +00:00
|
|
|
/*
|
2016-04-03 16:32:14 +00:00
|
|
|
Test("activate", function() {
|
2009-02-02 07:09:15 +00:00
|
|
|
ok(false, 'missing test - untested code is broken code');
|
|
|
|
});
|
|
|
|
|
|
|
|
test("deactivate", function() {
|
|
|
|
ok(false, 'missing test - untested code is broken code');
|
|
|
|
});
|
|
|
|
|
|
|
|
test("over", function() {
|
|
|
|
ok(false, 'missing test - untested code is broken code');
|
|
|
|
});
|
|
|
|
|
|
|
|
test("out", function() {
|
|
|
|
ok(false, 'missing test - untested code is broken code');
|
|
|
|
});
|
|
|
|
|
|
|
|
test("drop", function() {
|
|
|
|
ok(false, 'missing test - untested code is broken code');
|
|
|
|
});
|
2012-10-31 02:19:49 +00:00
|
|
|
*/
|
2009-02-02 07:09:15 +00:00
|
|
|
|
2015-04-07 00:35:27 +00:00
|
|
|
} );
|