Update scroll_helper_spec

This commit is contained in:
Luke "Jared" Bennett 2017-07-26 14:56:15 +01:00
parent dc5e7f3e98
commit b663a1fc95
No known key found for this signature in database
GPG Key ID: 402ED51FB5D306C2
1 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ describe('ScrollHelper', () => {
describe('getScrollWidth', () => {
const parent = jasmine.createSpyObj('parent', ['css', 'appendTo', 'remove']);
const child = jasmine.createSpyObj('child', ['css', 'appendTo', 'outerWidth']);
const child = jasmine.createSpyObj('child', ['css', 'appendTo', 'get']);
let scrollWidth;
beforeEach(() => {
@ -15,7 +15,9 @@ describe('ScrollHelper', () => {
parent.css.and.returnValue(parent);
child.css.and.returnValue(child);
child.outerWidth.and.returnValue(width);
child.get.and.returnValue({
offsetWidth: width,
});
scrollWidth = ScrollHelper.getScrollWidth();
});
@ -35,7 +37,7 @@ describe('ScrollHelper', () => {
});
expect(child.appendTo).toHaveBeenCalledWith(parent);
expect(parent.appendTo).toHaveBeenCalledWith('body');
expect(child.outerWidth).toHaveBeenCalled();
expect(child.get).toHaveBeenCalledWith(0);
expect(parent.remove).toHaveBeenCalled();
expect(scrollWidth).toEqual(100 - width);
});