var testSetFunc = function(el) { Scroll.setTop(el, SET_TEST_VALUE); expect(setTopSpyFunc.calls.count()).toBe(1); expect(setTopSpyFunc.calls.first().args[0]).toBe(SET_TEST_VALUE); Scroll.setLeft(el, SET_TEST_VALUE); expect(setLeftSpyFunc.calls.count()).toBe(1); expect(setLeftSpyFunc.calls.first().args[0]).toBe(SET_TEST_VALUE); };
'when documentElement is provided', function() { var setLeftBodySpyFunc; Object.defineProperty(document.body, 'scrollLeft', { set: setLeftBodySpyFunc = jasmine.createSpy(), configurable: true, }); Scroll.setLeft(document.documentElement, SET_TEST_VALUE); expect(setLeftSpyFunc.calls.count()).toBe(setLeftBodySpyFunc.calls.count()); expect(setLeftSpyFunc.calls.first().args[0]) .toBe(setLeftBodySpyFunc.calls.first().args[0]); expect(setLeftSpyFunc.calls.first().args[0]).toBe(SET_TEST_VALUE); delete document.body.scrollLeft; });