Skip to content

Commit

Permalink
chore: update animate-based tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jul 31, 2020
1 parent ae8ff49 commit 54b4327
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions spec/observables/dom/animationFrames-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('animationFrames', () => {

const result = mapped.pipe(mergeMapTo(animationFrames()));
expectObservable(result, subs).toBe(expected, {
a: ta - tm,
b: tb - tm,
c: tc - tm,
a: { elapsed: ta - tm, timestamp: ta },
b: { elapsed: tb - tm, timestamp: tb },
c: { elapsed: tc - tm, timestamp: tc },
});
});
});
Expand All @@ -50,9 +50,9 @@ describe('animationFrames', () => {

const result = mapped.pipe(mergeMapTo(animationFrames(timestampProvider)));
expectObservable(result, subs).toBe(expected, {
a: 50,
b: 150,
c: 250,
a: { elapsed: 50, timestamp: 100 },
b: { elapsed: 150, timestamp: 200 },
c: { elapsed: 250, timestamp: 300 },
});
});
});
Expand All @@ -71,8 +71,8 @@ describe('animationFrames', () => {

const result = mapped.pipe(mergeMapTo(animationFrames().pipe(take(2))));
expectObservable(result).toBe(expected, {
a: ta - tm,
b: tb - tm,
a: { elapsed: ta - tm, timestamp: ta },
b: { elapsed: tb - tm, timestamp: tb },
});

testScheduler.flush();
Expand All @@ -98,8 +98,8 @@ describe('animationFrames', () => {

const result = mapped.pipe(mergeMapTo(animationFrames().pipe(takeUntil(signal))));
expectObservable(result).toBe(expected, {
a: ta - tm,
b: tb - tm,
a: { elapsed: ta - tm, timestamp: ta },
b: { elapsed: tb - tm, timestamp: tb },
});

testScheduler.flush();
Expand Down
4 changes: 2 additions & 2 deletions src/internal/observable/dom/animationFrames.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { TimestampProvider } from "../../types";
import { dateTimestampProvider } from '../../scheduler/dateTimestampProvider';
import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';
import { requestAnimationFrameProvider } from '../../scheduler/requestAnimationFrameProvider';

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ function animationFramesFactory(timestampProvider?: TimestampProvider) {
// If no timestamp provider is specified, use performance.now() - as it
// will return timestamps 'compatible' with those passed to the run
// callback and won't be affected by NTP adjustments, etc.
const provider = timestampProvider || performance;
const provider = timestampProvider || performanceTimestampProvider;
// Capture the start time upon subscription, as the run callback can remain
// queued for a considerable period of time and the elapsed time should
// represent the time elapsed since subscription - not the time since the
Expand Down

0 comments on commit 54b4327

Please sign in to comment.