Skip to content

Commit

Permalink
Fix scroll-animation.html start and current time subtests (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland authored Feb 6, 2024
1 parent fe4339f commit 901e926
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/proxy-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,6 @@ function tickAnimation(timelineTime) {
(timelineTimeMs - fromCssNumberish(details, this.startTime)) *
this.playbackRate);

// Conditionally reset the hold time so that the finished state can be
// properly recomputed.
if (playState == 'finished' && effectivePlaybackRate(details) != 0)
details.holdTime = null;
updateFinishedState(details, false, false);
}
}
Expand Down Expand Up @@ -746,6 +742,12 @@ function createProxyEffect(details) {

let totalDuration;

if (timing.duration === Infinity) {
throw TypeError(
"Effect duration cannot be Infinity when used with Scroll " +
"Timelines");
}

// Duration 'auto' case.
if (timing.duration === null || timing.duration === 'auto' || details.autoDurationEffect) {
if (details.timeline) {
Expand Down
4 changes: 3 additions & 1 deletion src/scroll-timeline-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ export function addAnimation(scrollTimeline, animation, tickAnimation) {
animation: animation,
tickAnimation: tickAnimation
});
updateInternal(scrollTimeline);
queueMicrotask(() => {
updateInternal(scrollTimeline);
});
}

// TODO: this is a private function used for unit testing add function
Expand Down
6 changes: 3 additions & 3 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation start and current times are correct if scroll timeline is activated after animation.play call.
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation start and current times are correct if scroll timeline is activated after setting start time.
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation current time is correct when the timeline becomes newly inactive and then active again.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state when the animation starts playing with advanced scroller.
PASS /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state.
PASS /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state when the animation starts playing with advanced scroller.
PASS /scroll-animations/scroll-timelines/scroll-animation.html Finished animation plays on reverse scrolling.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Sending animation finished events by finished animation on reverse scrolling.
PASS /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html Animation current time and effect local time are updated after scroller content size changes.
Expand Down Expand Up @@ -960,7 +960,7 @@ PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting an unre
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting an unresolved start time sets the hold time to unresolved when the timeline is inactive
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting the start time resolves a pending ready promise
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting the start time resolves a pending ready promise when the timelineis inactive
FAIL /scroll-animations/scroll-timelines/setting-start-time.html Setting an unresolved start time on a play-pending animation makes it idle
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting an unresolved start time on a play-pending animation makes it idle
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting the start time updates the finished state
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting the start time on a running animation updates the play state
PASS /scroll-animations/scroll-timelines/setting-start-time.html Setting the start time on a reverse running animation updates the play state
Expand Down

0 comments on commit 901e926

Please sign in to comment.