Skip to content

Commit 034cce0

Browse files
devvaannshabose
authored andcommitted
chore: allow scroll clamp in tab bar wheel test
1 parent e4cf019 commit 034cce0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/spec/Extn-Tabbar-integ-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,8 +2802,10 @@ define(function (require, exports, module) {
28022802
// Check that scroll position has changed to the right
28032803
const scrollAfterDown = $tabBar.scrollLeft();
28042804
expect(scrollAfterDown).toBeGreaterThan(initialScrollLeft);
2805-
// Verify the scroll amount is proportional to deltaY (implementation multiplies by 2.5)
2806-
expect(scrollAfterDown - initialScrollLeft).toBeCloseTo(100 * 2.5, 0);
2805+
// scroll is deltaY * 2.5 unless clamped; the clamp point varies with font metrics
2806+
const maxScrollLeft = $tabBar[0].scrollWidth - $tabBar[0].clientWidth;
2807+
const expectedDown = Math.min(100 * 2.5, maxScrollLeft - initialScrollLeft);
2808+
expect(scrollAfterDown - initialScrollLeft).toBeCloseTo(expectedDown, 0);
28072809

28082810
// Create a wheel event for scrolling up (should scroll left)
28092811
const wheelEventUp = $.Event("wheel");
@@ -2815,8 +2817,8 @@ define(function (require, exports, module) {
28152817
// Check that scroll position has moved left from the previous position
28162818
const scrollAfterUp = $tabBar.scrollLeft();
28172819
expect(scrollAfterUp).toBeLessThan(scrollAfterDown);
2818-
// Verify the scroll amount is proportional to deltaY
2819-
expect(scrollAfterDown - scrollAfterUp).toBeCloseTo(100 * 2.5, 0);
2820+
const expectedUp = Math.min(100 * 2.5, scrollAfterDown);
2821+
expect(scrollAfterDown - scrollAfterUp).toBeCloseTo(expectedUp, 0);
28202822
});
28212823

28222824
it("should scroll tab bar with trackpad scrolling", function () {

0 commit comments

Comments
 (0)