Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scrollend event test for scroll combination #24028

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cathiechen
Copy link
Contributor

Hi @NavidZ ,
This patch adds test for scrollend event with scroll combination: press scrollbar + programmatic scroll.
PTAL, thanks:)

@cathiechen
Copy link
Contributor Author

Hi @NavidZ ,
Kindly ping:)
This test is about firing scrollend events for the combination of user scroll and programmatic scroll.
There should be two scrollend, one is for programmatic scroll (checked the scroll position when the first scrollend event fired), the other is for user scroll (checked the finall position).
WDYT? Is it reasonable?

Copy link
Member

@NavidZ NavidZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm no longer working on this project. But let me cc folks who are in charge now. Particularly this test may need some more in depth discussion and possibly some spec changes that is better to be discussed with @mustaqahmed and @flackr at this point.

await waitFor(() => { return user_scrollend_arrived; },
'target_div did not receive two scrollend events after pressing scrollbar and performing programmatic scroll.');
assert_true(target_div.scrollTop > 0);
await checkFinalPosition(target_div, { x: target_div.scrollLeft, y: target_div.scrollTop }, 300);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My expectation here is that if scrollend event is received the offsets are updated as well on the main thread. Do we need to wait for 300ms before checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true. The intent is to make sure there's no more scroll position change after receiving user scroll scrollend event.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, presumably line 92 makes sure that we have scrolled and line 93 is asserting that we don't continue to scroll after the scrollend event.

// Perform programmatic scroll during user scrolling.
if (target_div.scrollTop > 50) {
target_div.scrollTop = programmatic_scroll_top;
programmatic_scroll_done = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting situation that is not clear in the spec the way it is written now. Particularly I'm not sure whether sending just one scrollend after all scrollings are done is better or sending two as you have here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, make sense. Maybe we can discuss it on the issue? WICG/overscroll-scrollend-events#4

@cathiechen
Copy link
Contributor Author

Hi NavidZ, thanks for the review:)
I've added @mustaqahmed and @flackr as the reviewer:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants