chore: fix tests

This commit is contained in:
Roman Hotsiy 2017-06-14 11:27:50 +03:00
parent 8e8d9d8995
commit 5cc1208bb1
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 5 additions and 2 deletions

View File

@ -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();

View File

@ -90,7 +90,7 @@ export class StickySidebar implements OnInit, OnDestroy, OnChanges {
}
ngOnChanges() {
if (this.disable) return;
if (!this.$redocEl || this.disable) return;
this.updatePosition();
}