Use spies instead of monkey patching

This commit is contained in:
Nathan Sobo
2017-03-22 12:09:49 -06:00
committed by Antonio Scandurra
parent 47761a455e
commit f2e2475c62

View File

@@ -885,10 +885,8 @@ describe('TextEditorComponent', () => {
fakeWindow.appendChild(element)
jasmine.attachToDOM(fakeWindow)
component.getWindowInnerWidth = () => fakeWindow.getBoundingClientRect().width
component.getWindowInnerHeight = () => fakeWindow.getBoundingClientRect().height
// spyOn(component, 'getWindowInnerWidth').andCallFake(() => fakeWindow.getBoundingClientRect().width)
// spyOn(component, 'getWindowInnerHeight').andCallFake(() => fakeWindow.getBoundingClientRect().height)
spyOn(component, 'getWindowInnerWidth').andCallFake(() => fakeWindow.getBoundingClientRect().width)
spyOn(component, 'getWindowInnerHeight').andCallFake(() => fakeWindow.getBoundingClientRect().height)
await setScrollTop(component, 50)
await setScrollLeft(component, 100)