Skip to content

Commit

Permalink
chore: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Jan 30, 2019
1 parent 81776bc commit a751213
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/anchor/anchor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a751213

Please sign in to comment.