From a7512132a130a3e0119a7ec290cb7b38a0cf066f Mon Sep 17 00:00:00 2001 From: cipchk Date: Wed, 30 Jan 2019 19:32:16 +0800 Subject: [PATCH] chore: add test --- components/anchor/anchor.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/anchor/anchor.spec.ts b/components/anchor/anchor.spec.ts index 66a992c6d2f..85f6335f557 100644 --- a/components/anchor/anchor.spec.ts +++ b/components/anchor/anchor.spec.ts @@ -62,6 +62,19 @@ describe('anchor', () => { }, throttleTime); }); + it('should clean actived when leave all anchor', fakeAsync(() => { + spyOn(context.comp, 'clearActive' as any); + page.scrollTo(); + tick(throttleTime); + fixture.detectChanges(); + expect(context.comp['clearActive']).not.toHaveBeenCalled(); + window.scrollTo(0, 0); + window.dispatchEvent(new Event('scroll')); + tick(throttleTime); + fixture.detectChanges(); + expect(context.comp['clearActive']).toHaveBeenCalled(); + })); + it(`won't scolling when is not exists link`, () => { spyOn(srv, 'getScroll'); expect(context._scroll).not.toHaveBeenCalled();