You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
5 years ago
|
define( [
|
||
|
"qunit",
|
||
|
"jquery",
|
||
|
"ui/widgets/droppable"
|
||
|
], function( QUnit, $ ) {
|
||
|
|
||
|
QUnit.module( "droppable: events" );
|
||
|
|
||
|
QUnit.test( "droppable destruction/recreation on drop event", function( assert ) {
|
||
|
assert.expect( 1 );
|
||
|
|
||
|
var config = {
|
||
|
activeClass: "active",
|
||
|
drop: function() {
|
||
|
var element = $( this ),
|
||
|
newDroppable = $( "<div>" )
|
||
|
.css( { width: 100, height: 100 } )
|
||
|
.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
|
||
|
} );
|
||
|
|
||
|
assert.lacksClasses( droppable2, "active", "subsequent droppable no longer active" );
|
||
|
} );
|
||
|
|
||
|
// Todo: comment the following in when ready to actually test
|
||
|
/*
|
||
|
Test("activate", function() {
|
||
|
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');
|
||
|
});
|
||
|
*/
|
||
|
|
||
|
} );
|