From 7743c43529fd04c530c9ef6c34830304c39f1540 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 21 Apr 2020 09:59:39 -0700 Subject: [PATCH] test(router): fix router test failing on IE (#36742) This was originally fixed in #35976, but one of the window.scrollY assertions was missed. Also updated tests to use toBeGreater/LessThan to improve failure messages. PR Close #36742 --- packages/router/test/bootstrap.spec.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/router/test/bootstrap.spec.ts b/packages/router/test/bootstrap.spec.ts index 5fa0932718..e364519a8d 100644 --- a/packages/router/test/bootstrap.spec.ts +++ b/packages/router/test/bootstrap.spec.ts @@ -297,7 +297,6 @@ describe('bootstrap', () => { const res = await platformBrowserDynamic([]).bootstrapModule(TestModule); const router = res.injector.get(Router); - const location: Location = res.injector.get(Location); await router.navigateByUrl('/aa'); window.scrollTo(0, 5000); @@ -317,12 +316,12 @@ describe('bootstrap', () => { expect(getScrollY()).toEqual(0); await router.navigateByUrl('/aa#marker2'); - expect(getScrollY() >= 5900).toBe(true); - expect(window.scrollY < 6000).toBe(true); // offset + expect(getScrollY()).toBeGreaterThanOrEqual(5900); + expect(getScrollY()).toBeLessThan(6000); // offset await router.navigateByUrl('/aa#marker3'); - expect(getScrollY() >= 8900).toBe(true); - expect(getScrollY() < 9000).toBe(true); + expect(getScrollY()).toBeGreaterThanOrEqual(8900); + expect(getScrollY()).toBeLessThan(9000); done(); });