From d729aa73836c4b74b09a8b84ad97694ee858f34c Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 29 Sep 2017 09:40:21 +0100 Subject: spec fix --- spec/javascripts/lib/utils/common_utils_spec.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js index 03c02ea06a8..f86f2f260c3 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js +++ b/spec/javascripts/lib/utils/common_utils_spec.js @@ -92,13 +92,12 @@ describe('common_utils', () => {
`; - const elTop = document.getElementById('test').getBoundingClientRect().top; window.history.pushState({}, null, '#test'); commonUtils.handleLocationHash(); expectGetElementIdToHaveBeenCalledWith('test'); - expect(window.scrollY).toBe(elTop); + expect(window.scrollY).toBe(document.getElementById('test').offsetTop); document.getElementById('parent').remove(); }); @@ -110,14 +109,13 @@ describe('common_utils', () => {
`; - const elTop = document.getElementById('user-content-test').getBoundingClientRect().top; window.history.pushState({}, null, '#test'); commonUtils.handleLocationHash(); expectGetElementIdToHaveBeenCalledWith('test'); expectGetElementIdToHaveBeenCalledWith('user-content-test'); - expect(window.scrollY).toBe(elTop); + expect(window.scrollY).toBe(document.getElementById('user-content-test').offsetTop); document.getElementById('parent').remove(); }); @@ -132,14 +130,12 @@ describe('common_utils', () => { `; - const elTop = document.getElementById('user-content-test').getBoundingClientRect().top; - window.history.pushState({}, null, '#test'); commonUtils.handleLocationHash(); expectGetElementIdToHaveBeenCalledWith('test'); expectGetElementIdToHaveBeenCalledWith('user-content-test'); - expect(window.scrollY).toBe(elTop - 50); + expect(window.scrollY).toBe(document.getElementById('user-content-test').offsetTop - 50); expect(window.scrollBy).toHaveBeenCalledWith(0, -50); document.getElementById('parent').remove(); -- cgit v1.2.1