BigW Consortium Gitlab

Update scroll_helper_spec

parent dc5e7f3e
...@@ -6,7 +6,7 @@ describe('ScrollHelper', () => { ...@@ -6,7 +6,7 @@ describe('ScrollHelper', () => {
describe('getScrollWidth', () => { describe('getScrollWidth', () => {
const parent = jasmine.createSpyObj('parent', ['css', 'appendTo', 'remove']); 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; let scrollWidth;
beforeEach(() => { beforeEach(() => {
...@@ -15,7 +15,9 @@ describe('ScrollHelper', () => { ...@@ -15,7 +15,9 @@ describe('ScrollHelper', () => {
parent.css.and.returnValue(parent); parent.css.and.returnValue(parent);
child.css.and.returnValue(child); child.css.and.returnValue(child);
child.outerWidth.and.returnValue(width); child.get.and.returnValue({
offsetWidth: width,
});
scrollWidth = ScrollHelper.getScrollWidth(); scrollWidth = ScrollHelper.getScrollWidth();
}); });
...@@ -35,7 +37,7 @@ describe('ScrollHelper', () => { ...@@ -35,7 +37,7 @@ describe('ScrollHelper', () => {
}); });
expect(child.appendTo).toHaveBeenCalledWith(parent); expect(child.appendTo).toHaveBeenCalledWith(parent);
expect(parent.appendTo).toHaveBeenCalledWith('body'); expect(parent.appendTo).toHaveBeenCalledWith('body');
expect(child.outerWidth).toHaveBeenCalled(); expect(child.get).toHaveBeenCalledWith(0);
expect(parent.remove).toHaveBeenCalled(); expect(parent.remove).toHaveBeenCalled();
expect(scrollWidth).toEqual(100 - width); expect(scrollWidth).toEqual(100 - width);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment