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() { 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() { ngOnInit() {

View File

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