aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/droppable/events.js
blob: 8b2bbd38e9b74cc3e44065ea02d571945ab41462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
define( [
	"qunit",
	"jquery",
	"lib/helper",
	"ui/widgets/droppable"
], function( QUnit, $, helper ) {
"use strict";

QUnit.module( "droppable: events", { afterEach: helper.moduleAfterEach }  );

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');
});
*/

} );