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);
});
});
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();
});
});
const currentIndex = panel.index;
let indexToMove;
let isPositive;
let no = noValue;
no = utils.getNumValue(no, -1);
if (no < 0 || no >= panel.origCount || no === panel.no ||
panel.animating || conf.touch.holding) {
return this;
}
indexToMove = no - (circular ? panel.no : currentIndex);
if (direction === Axes.DIRECTION_RIGHT && indexToMove < 0) {
indexToMove += panel.origCount;
} else if (direction === Axes.DIRECTION_LEFT && indexToMove > 0) {
indexToMove -= panel.origCount;
}
isPositive = indexToMove > 0;
// check for real panel count which can be moved on each sides in circular mode
if (circular &&
Math.abs(indexToMove) >
(isPositive ? panel.count - (currentIndex + 1) : currentIndex)) {
indexToMove += (isPositive ? -1 : 1) * panel.count;
isPositive = indexToMove > 0;
}
this._setPanelNo(circular ? {no} : {no, index: no});
this._conf.indexToMove = indexToMove;
this._setValueToMove(isPositive);
_setAdaptiveHeight(direction) {
const conf = this._conf;
const indexToMove = conf.indexToMove;
let $children;
let height;
const $panel = indexToMove === 0 ?
// panel moved by 1
this[`get${
(direction === Axes.DIRECTION_LEFT && "Next") ||
(direction === Axes.DIRECTION_RIGHT && "Prev") || ""
}Element`]() :
// panel moved by .moveTo()
conf.panel.$list[
conf.panel.currIndex + indexToMove
];
const $first = $panel.querySelector(":first-child");
if ($first) {
height = $first.getAttribute(DATA_HEIGHT);
if (!height) {
$children = $panel.children;
_proto.prev = function prev(duration) {
var index = this.getPrevIndex();
if (typeof index !== "number") {
return this;
}
return this._moveTo(index, duration, Axes.DIRECTION_LEFT);
};
/**
prev(duration) {
const index = this.getPrevIndex();
if (typeof index !== "number") {
return this;
}
return this._moveTo(index, duration, Axes.DIRECTION_LEFT);
}
* @type {Number}
* @default 1
*/
static DIRECTION_NONE = Axes.DIRECTION_NONE;
/**
* Constant value for left direction.
* @ko left 방향에 대한 상수 값.
* @name DIRECTION_LEFT
* @memberof eg.Flicking
* @static
* @constant
* @type {Number}
* @default 2
*/
static DIRECTION_LEFT = Axes.DIRECTION_LEFT;
/**
* Constant value for right direction.
* @ko right 방향에 대한 상수 값.
* @name DIRECTION_RIGHT
* @memberof eg.Flicking
* @static
* @constant
* @type {Number}
* @default 4
*/
static DIRECTION_RIGHT = Axes.DIRECTION_RIGHT;
/**
* Constant value for up direction.
* @ko up 방향에 대한 상수 값.