Skip to content

Commit 01789f5

Browse files
committed
Make performance.now behave more like real world
1 parent 1cd0565 commit 01789f5

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

projects/ng-dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sama/ng-dev",
3-
"version": "20.0.0",
3+
"version": "20.0.1",
44
"author": "Samasource",
55
"license": "MIT",
66
"homepage": "https://github.com/Samasource/s-libs/tree/master/projects/ng-dev",

projects/ng-dev/src/lib/angular-context/angular-context.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ export class AngularContext {
260260
#runWithMockedTime(test: VoidFunction): void {
261261
// https://github.com/angular/angular/issues/31677#issuecomment-573139551
262262
const { now } = performance;
263-
spyOn(performance, 'now').and.callFake(() => Date.now());
263+
spyOn(performance, 'now').and.callFake(
264+
() => Date.now() - this.startTime.getTime(),
265+
);
264266

265267
jasmine.clock().install();
266268
fakeAsync(() => {

0 commit comments

Comments
 (0)