Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("next()", () => {
// When
// 2 -> 3
inst.next(0);
// direction is from right to left
const direction1 = inst._conf.touch.direction;
// 3 -> 1
inst.next(0);
// direction is from right to left
const direction2 = inst._conf.touch.direction;
// Then
expect(direction1).to.be.equals(Axes.DIRECTION_LEFT);
expect(direction2).to.be.equals(Axes.DIRECTION_LEFT);
});
});
it("next()", () => {
// When
// 2 -> 3
inst.next(0);
// direction is from right to left
const direction1 = inst._conf.touch.direction;
// 3 -> 1
inst.next(0);
// direction is from right to left
const direction2 = inst._conf.touch.direction;
// Then
expect(direction1).to.be.equals(Axes.DIRECTION_LEFT);
expect(direction2).to.be.equals(Axes.DIRECTION_LEFT);
});
});
it("prev()", () => {
// When
// 1 -> 3
inst.prev(0);
// direction is from left to right.
const direction1 = inst._conf.touch.direction;
// 3 -> 2
inst.prev(0);
// direction is from left to right.
const direction2 = inst._conf.touch.direction;
// Then
expect(direction1).to.be.equals(Axes.DIRECTION_RIGHT);
expect(direction2).to.be.equals(Axes.DIRECTION_RIGHT);
});
it("next()", () => {
it("prev()", () => {
// When
// 1 -> 3
inst.prev(0);
// direction is from left to right.
const direction1 = inst._conf.touch.direction;
// 3 -> 2
inst.prev(0);
// direction is from left to right.
const direction2 = inst._conf.touch.direction;
// Then
expect(direction1).to.be.equals(Axes.DIRECTION_RIGHT);
expect(direction2).to.be.equals(Axes.DIRECTION_RIGHT);
});
it("next()", () => {
tutils.simulator($el, { deltaX: -100, deltaY: 90 }, () => {
// Is left during touch hold?
expect(check(directionHold[id], Axes.DIRECTION_LEFT)).to.be.ok;
// Is left during touch unhold?
expect(check(directionUnhold[id], Axes.DIRECTION_LEFT)).to.be.ok;
done();
});
});
tutils.simulator($el, { deltaX: -100, deltaY: 90 }, () => {
// Is left during touch hold?
expect(check(directionHold[id], Axes.DIRECTION_LEFT)).to.be.ok;
// Is left during touch unhold?
expect(check(directionUnhold[id], Axes.DIRECTION_LEFT)).to.be.ok;
done();
});
});
// The panel restored in its original position?
expect(currPos % inst._conf.panel.size === 0).to.be.ok;
// Restored panel index value?
expect(panelIndex).to.deep.equal({
no: inst._conf.panel.no,
index: inst._conf.panel.index
});
// Restore events are fired correctly?
expect($el.eventFired).to.deep.equal(["beforeRestore", "flick", "restore"]);
let direction = tutils.unique($el.eventDirection);
// Direction value of restore event are right?
expect(direction.length === 1 && direction[0] === Axes.DIRECTION_RIGHT).to.be.ok;
done();
});
});
tutils.simulator($el, { deltaX: 100, deltaY: 50 }, () => {
// Is right during touch hold?
expect(check(directionHold[id], Axes.DIRECTION_RIGHT)).to.be.ok;
// Is right during touch unhold?
expect(check(directionUnhold[id], Axes.DIRECTION_RIGHT)).to.be.ok;
done();
});
});
tutils.simulator($el, { deltaX: -50, deltaY: 100 }, () => {
// Is down during touch hold?
expect(check(directionHold[id], Axes.DIRECTION_DOWN)).to.be.ok;
// Is down during touch unhold?
expect(check(directionUnhold[id], Axes.DIRECTION_DOWN)).to.be.ok;
done();
});
});
tutils.simulator($el, { deltaX: -50, deltaY: 100 }, () => {
// Is down during touch hold?
expect(check(directionHold[id], Axes.DIRECTION_DOWN)).to.be.ok;
// Is down during touch unhold?
expect(check(directionUnhold[id], Axes.DIRECTION_DOWN)).to.be.ok;
done();
});
});