From 5cc1208bb17875e6383a6c1d19872fdf44b7ecfe Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 14 Jun 2017 11:27:50 +0300 Subject: [PATCH] chore: fix tests --- lib/shared/components/StickySidebar/sticky-sidebar.spec.ts | 5 ++++- lib/shared/components/StickySidebar/sticky-sidebar.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/shared/components/StickySidebar/sticky-sidebar.spec.ts b/lib/shared/components/StickySidebar/sticky-sidebar.spec.ts index 80ba01cd..a5216d3c 100644 --- a/lib/shared/components/StickySidebar/sticky-sidebar.spec.ts +++ b/lib/shared/components/StickySidebar/sticky-sidebar.spec.ts @@ -15,7 +15,7 @@ describe('Common components', () => { }); describe('StickySidebar Component', () => { let builder; - let component; + let component: StickySidebar; let fixture; beforeEach(() => { @@ -31,6 +31,7 @@ describe('Common components', () => { }); it('should start unsticked', () => { + component.disable = true; spyOn(component, 'stick').and.callThrough(); spyOn(component, 'stickBottom').and.callThrough(); fixture.detectChanges(); @@ -41,7 +42,9 @@ describe('Common components', () => { it('should stick to the top on the next animation frame', (done) => { spyOn(component, 'stick').and.callThrough(); spyOn(component, 'stickBottom').and.callThrough(); + component.disable = true; fixture.detectChanges(); + component.disable = false; requestAnimationFrame(() => { expect(component.stick).toHaveBeenCalled(); expect(component.stickBottom).toHaveBeenCalled(); diff --git a/lib/shared/components/StickySidebar/sticky-sidebar.ts b/lib/shared/components/StickySidebar/sticky-sidebar.ts index 69a8518d..2cb9eea4 100644 --- a/lib/shared/components/StickySidebar/sticky-sidebar.ts +++ b/lib/shared/components/StickySidebar/sticky-sidebar.ts @@ -90,7 +90,7 @@ export class StickySidebar implements OnInit, OnDestroy, OnChanges { } ngOnChanges() { - if (this.disable) return; + if (!this.$redocEl || this.disable) return; this.updatePosition(); }