Fix tests

This commit is contained in:
Roman Hotsiy 2016-01-17 21:50:42 +02:00
parent c45df1e445
commit 0712297ba5
2 changed files with 4 additions and 2 deletions

View File

@ -55,7 +55,7 @@ export default class StickySidebar {
}
get scrollY() {
return (this.scrollParent.pageYOffset === null) ? this.scrollParent.scrollTop : this.scrollParent.pageYOffset;
return (this.scrollParent.pageYOffset !== null) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop;
}
ngOnInit() {

View File

@ -49,7 +49,9 @@ describe('Common components', () => {
it('should stick if scrolled more than scrollYOffset', () => {
spyOn(component, 'stick').and.callThrough();
fixture.detectChanges();
window.pageYOffset = 40;
component.scrollParent = {
pageYOffset: 40
};
component.updatePosition();
expect(component.stick).toHaveBeenCalled();
});