Software: Apache. PHP/5.6.40 uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24 uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) Safe-mode: OFF (not secure) /home/cp949260/public_html/mophlawyer.com/ladiesmoph/moph_admin/bower_components/dragula.js/test/ drwxr-xr-x |
Viewing file: Select action/file-type: 'use strict'; var test = require('tape'); var events = require('./lib/events'); var dragula = require('..'); test('remove does not throw when not dragging', function (t) { t.test('a single time', function once (st) { var drake = dragula(); st.doesNotThrow(function () { drake.remove(); }, 'dragula ignores a single call to drake.remove'); st.end(); }); t.test('multiple times', function once (st) { var drake = dragula(); st.doesNotThrow(function () { drake.remove(); drake.remove(); drake.remove(); drake.remove(); }, 'dragula ignores multiple calls to drake.remove'); st.end(); }); t.end(); }); test('when dragging and remove gets called, element is removed', function (t) { var div = document.createElement('div'); var item = document.createElement('div'); var drake = dragula([div]); div.appendChild(item); document.body.appendChild(div); drake.start(item); drake.remove(); t.equal(div.children.length, 0, 'item got removed from container'); t.equal(drake.dragging, false, 'drake has stopped dragging'); t.end(); }); test('when dragging and remove gets called, remove event is emitted', function (t) { var div = document.createElement('div'); var item = document.createElement('div'); var drake = dragula([div]); div.appendChild(item); document.body.appendChild(div); drake.start(item); drake.on('remove', remove); drake.on('dragend', dragend); drake.remove(); t.plan(3); t.end(); function dragend () { t.pass('dragend got called'); } function remove (target, container) { t.equal(target, item, 'remove was invoked with item'); t.equal(container, div, 'remove was invoked with container'); } }); test('when dragging a copy and remove gets called, cancel event is emitted', function (t) { var div = document.createElement('div'); var item = document.createElement('div'); var drake = dragula([div], { copy: true }); div.appendChild(item); document.body.appendChild(div); events.raise(item, 'mousedown', { which: 1 }); events.raise(item, 'mousemove', { which: 1 }); drake.on('cancel', cancel); drake.on('dragend', dragend); drake.remove(); t.plan(4); t.end(); function dragend () { t.pass('dragend got called'); } function cancel (target, container) { t.equal(target.className, 'gu-transit', 'cancel was invoked with item'); t.notEqual(target, item, 'item is a copy and not the original'); t.equal(container, null, 'cancel was invoked with container'); } }); |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0148 ]-- |