MCPcopy
hub / github.com/bevacqua/dragula / testCase

Function testCase

test/drag.js:19–40  ·  view source on GitHub ↗
(desc, eventOptions, options)

Source from the content-addressed store, hash-verified

17 testCase('fails whenever moves returns false', { which: 1 }, { passes: false, dragulaOpts: { moves: never } });
18 t.end();
19 function testCase (desc, eventOptions, options) {
20 t.test(desc, function subtest (st) {
21 var o = options || {};
22 var div = document.createElement('div');
23 var item = document.createElement(o.tag || 'div');
24 var passes = o.passes !== false;
25 var drake = dragula([div], o.dragulaOpts);
26 div.appendChild(item);
27 document.body.appendChild(div);
28 drake.on('drag', drag);
29 events.raise(o.containerClick ? div : item, 'mousedown', eventOptions);
30 events.raise(o.containerClick ? div : item, 'mousemove');
31 st.plan(passes ? 4 : 1);
32 st.equal(drake.dragging, passes, desc + ': final state is drake is ' + (passes ? '' : 'not ') + 'dragging');
33 st.end();
34 function drag (target, container) {
35 st[passes ? 'pass' : 'fail'](desc + ': drag event was emitted synchronously');
36 st.equal(target, item, desc + ': first argument is selected item');
37 st.equal(container, div, desc + ': second argument is container');
38 }
39 });
40 }
41});
42
43test('when already dragging, mousedown/mousemove ends (cancels) previous drag', function (t) {

Callers 1

drag.jsFile · 0.85

Calls 1

dragulaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…