Skip to content

Commit

Permalink
test: add test for strict control on circular flicking
Browse files Browse the repository at this point in the history
  • Loading branch information
malangfox committed Nov 30, 2023
1 parent fa08e77 commit 044b725
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/unit/control/StrictControl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,19 @@ describe("StrictControl", () => {
expect(moveSpy.calledTwice).to.be.true;
expect(control.activePanel.index).to.equal(camera.findNearestAnchor(position).panel.index);
});

it("should determine the next panel based on the target panel of the willChange event", async () => {
const flicking = await createFlicking(El.DEFAULT_HORIZONTAL, { moveType: MOVE_TYPE.STRICT, circular: true, duration: 5000, threshold: 0 });

await simulate(flicking.element, { deltaX: 900, duration: 100 }, 1000);
tick(500);
await simulate(flicking.element, { deltaX: 900, duration: 100 }, 1000);
tick(500);
await simulate(flicking.element, { deltaX: 900, duration: 100 }, 1000);
tick(5000);

expect(flicking.index).to.equal(0);
});
});
});
});

0 comments on commit 044b725

Please sign in to comment.