Skip to content

Commit

Permalink
fix: prevent jumping when in START state
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Nov 28, 2021
1 parent 7283b86 commit e7850b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/fsm-transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default {
to: states.FINISH,
when: (d) => [
d.isSideInnerWithinPath === true,
d.viewportTop + d.sideInnerHeight > d.finishPoint
d.viewportTop + d.sideInnerHeight + d.bottomSpacing > d.finishPoint,
d.viewportBottom > d.finishPoint
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions test/transitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('transitions', function() {
// isSideInnerWithinPath === true
describe('when height(content) > height(sidebarInner)', () => {
beforeEach(async () => {
setContentHeight(sidebarInnerHeight * 2);
setContentHeight(sidebarInnerHeight * 1.5);
await nextFrame();
});

Expand All @@ -220,7 +220,7 @@ describe('transitions', function() {
await forceUpdate();
expectTransitionTo(BOTTOM_FIXED);

setContentHeight(sidebarInnerHeight / 2);
setContentHeight(sidebarInnerHeight / 1.5);
await forceUpdate();
expectTransitionTo(START);
});
Expand Down Expand Up @@ -274,7 +274,7 @@ describe('transitions', function() {
await forceUpdate();
expectTransitionTo(UNFIXED);

setContentHeight(sidebarInnerHeight / 2);
setContentHeight(sidebarInnerHeight / 1.5);
await forceUpdate();
expectTransitionTo(START);
});
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('transitions', function() {
});

it('START => FINISH', async () => {
await scrollTo(getElementBottom(contentElement) - window.innerHeight);
await scrollTo(getElementBottom(contentElement) - window.innerHeight + 1);
await forceUpdate();
expectTransitionTo(FINISH);
});
Expand Down

0 comments on commit e7850b4

Please sign in to comment.