Replace happen.drag by prosthetic-hand in specs

This commit is contained in:
Yohan Boniface 2016-03-28 21:51:27 +02:00
parent 24a2a11715
commit 61da775379
2 changed files with 7 additions and 25 deletions

View File

@ -51,29 +51,6 @@ happen.at = function (what, x, y, props) {
button: 0
}, props || {}));
};
happen.drag = function (fromX, fromY, toX, toY, then, duration) {
happen.at('mousemove', fromX, fromY);
happen.at('mousedown', fromX, fromY);
var moveX = function () {
if (fromX <= toX) {
happen.at('mousemove', fromX++, fromY);
window.setTimeout(moveX, 5);
}
};
moveX();
var moveY = function () {
if (fromY <= toY) {
happen.at('mousemove', fromX, fromY++);
window.setTimeout(moveY, 5);
}
};
moveY();
window.setTimeout(function () {
happen.at('mouseup', toX, toY);
happen.at('click', toX, toY);
if (then) { then(); }
}, duration || 100);
};
// We'll want to skip a couple of things when in PhantomJS, due to lack of CSS animations
it.skipInPhantom = L.Browser.any3d ? it : it.skip;

View File

@ -290,12 +290,17 @@ describe("L.Map#openPopup", function () {
map.openPopup(p);
expect(map.hasLayer(p)).to.be(true);
map.on('drag', spy);
happen.drag(coords.left + 100, coords.top + 100, coords.left + 110, coords.top + 110, function () {
var hand = new Hand({timing: 'fastframe'});
var mouse = hand.growFinger('mouse');
mouse.moveTo(coords.left + 100, coords.left + 100, 0)
.down().moveBy(10, 10, 20).up();
setTimeout(function () {
expect(spy.called).to.be(true);
expect(map.hasLayer(p)).to.be(true);
document.body.removeChild(c);
done();
});
}, 60);
});
});