-
Notifications
You must be signed in to change notification settings - Fork 35
WRR-29169: Improved scroll animation method #3353
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
Open
ion-andrusciac-lgp
wants to merge
37
commits into
develop
Choose a base branch
from
feature/WRR-29169-1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
4169150
Changed scroll animation
ion-andrusciac-lgp e89ac70
Changed timing animation function
ion-andrusciac-lgp 0c03026
Fixed lint warnings
ion-andrusciac-lgp 814da10
Adjusted animation function
ion-andrusciac-lgp 1a4b0c2
Merge branch 'develop' of https://github.com/enactjs/enact into featu…
ion-andrusciac-lgp 4437865
Adjusted timing function
ion-andrusciac-lgp 47bf3f8
Added `unit-tests`
ion-andrusciac-lgp 15066be
Added `unit-tests`
ion-andrusciac-lgp 42c9da2
Added `unit-tests`
ion-andrusciac-lgp fe64975
Adjusted animation function
ion-andrusciac-lgp 1d790e7
Fixed lint warnings
ion-andrusciac-lgp acaf252
Adjustments
ion-andrusciac-lgp 8e39da9
Added acceleration to scroll
ion-andrusciac-lgp c0048aa
Small fix
ion-andrusciac-lgp 7e0a4fc
Small fix
ion-andrusciac-lgp a4149bc
Small fix
ion-andrusciac-lgp 5b515a9
Merge branch 'develop' of https://github.com/enactjs/enact into featu…
ion-andrusciac-lgp f2d6800
Small fix
ion-andrusciac-lgp bea7552
Small fix
ion-andrusciac-lgp 036c536
Merge branch 'develop' of https://github.com/enactjs/enact into featu…
ion-andrusciac-lgp ca5213e
Fixed `unit-tests`
ion-andrusciac-lgp 933c019
Fixed lint warnings
ion-andrusciac-lgp 06e4b91
Merge remote-tracking branch 'origin/develop' into feature/WRR-29169-1
daniel-stoian-lgp d65d139
Merge branch 'feature/WRR-29169-1' of https://github.com/enactjs/enac…
daniel-stoian-lgp ef0dbee
Added `CHANGELOG`
ion-andrusciac-lgp 50fa46f
Review fixes
ion-andrusciac-lgp 6cd37e7
Adjusted animation function
ion-andrusciac-lgp c1e0570
Small fix
ion-andrusciac-lgp 5f37204
Merge branch 'develop' of https://github.com/enactjs/enact into featu…
ion-andrusciac-lgp 7a9accb
Small fix
ion-andrusciac-lgp 2970d77
Small fix
ion-andrusciac-lgp 0c7a07d
Fixed lint warnings
ion-andrusciac-lgp ddb74d6
Fixed unit tests
ion-andrusciac-lgp 58b942d
Added condition to apply animation only on `ev.repeat`
ion-andrusciac-lgp d1d9951
Added description for `animateScroll`
ion-andrusciac-lgp 976f14e
Merge branch 'develop' of https://github.com/enactjs/enact into featu…
ion-andrusciac-lgp 538f7f6
Adjusted scroll pace
ion-andrusciac-lgp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import '@testing-library/jest-dom'; | ||
|
|
||
| import {ScrollerBasic} from '../Scroller'; | ||
|
|
||
| describe('ScrollBasic', () => { | ||
| let scrollContentRef; | ||
|
|
||
| beforeEach(() => { | ||
| jest.createMockFromModule('@enact/core/platform'); | ||
|
|
||
| scrollContentRef = { | ||
| current: { | ||
| scrollLeft: 0, | ||
| scrollTop: 0, | ||
| scrollBy: jest.fn(), | ||
| scrollTo: jest.fn() | ||
| } | ||
| }; | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| test( | ||
| 'should call scrollBy on scrollToPosition', | ||
| () => { | ||
| const instance = new ScrollerBasic({scrollContentRef, direction: 'both'}); | ||
|
|
||
| instance.scrollToPosition(100, 200, 'smooth'); | ||
| expect(scrollContentRef.current.scrollTo).toHaveBeenCalledWith({left: 100, top: 200, behavior: 'smooth'}); | ||
|
|
||
| instance.scrollToPosition(100, 200, 'instant'); | ||
| expect(scrollContentRef.current.scrollTo).toHaveBeenCalledWith({left: 100, top: 200, behavior: 'instant'}); | ||
| } | ||
| ); | ||
|
|
||
| test( | ||
| 'should call scrollBy with animated values during animateScroll', | ||
| () => { | ||
| let rafCallback; | ||
| const instance = new ScrollerBasic({scrollContentRef, direction: 'both'}); | ||
| instance.scrollBounds.maxTop = 500; | ||
| instance.scrollBounds.maxLeft = 500; | ||
|
|
||
| window.requestAnimationFrame = jest.fn((cb) => { | ||
| rafCallback = cb; | ||
| }); | ||
| window.cancelAnimationFrame = jest.fn(); | ||
|
|
||
| instance.animateScroll(100, 200, scrollContentRef.current); | ||
| rafCallback(); | ||
| expect(scrollContentRef.current.scrollBy).toHaveBeenCalled(); | ||
|
|
||
| scrollContentRef.current.scrollTop = 500; | ||
| instance.animateScroll(550, 550, scrollContentRef.current); | ||
| rafCallback(); | ||
| expect(window.cancelAnimationFrame).toHaveBeenCalled(); | ||
| } | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.