From 5ad77f7627a53572fb26d79e9e5bf944626d6605 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Mon, 17 May 2021 11:31:42 +0300 Subject: [PATCH] fixes after review --- js/tests/unit/util/scrollbar.spec.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/js/tests/unit/util/scrollbar.spec.js b/js/tests/unit/util/scrollbar.spec.js index 1d0357619b5d..b51c8a979551 100644 --- a/js/tests/unit/util/scrollbar.spec.js +++ b/js/tests/unit/util/scrollbar.spec.js @@ -65,7 +65,7 @@ describe('ScrollBar', () => { }) it('should return false if body is not overflowing', () => { - document.documentElement.style.overflowY = 'hidden' + doc.style.overflowY = 'hidden' document.body.style.overflowY = 'hidden' fixtureEl.innerHTML = [ '
' @@ -78,7 +78,7 @@ describe('ScrollBar', () => { describe('getWidth', () => { it('should return an integer greater than zero, if body is overflowing', () => { - document.documentElement.style.overflowY = 'scroll' + doc.style.overflowY = 'scroll' document.body.style.overflowY = 'scroll' fixtureEl.innerHTML = [ '
' @@ -109,11 +109,11 @@ describe('ScrollBar', () => { it('should adjust the inline padding of fixed elements which are full-width', done => { fixtureEl.innerHTML = [ '
' + - '
', + '
', '
', '
' ].join('') - document.documentElement.style.overflowY = 'scroll' + doc.style.overflowY = 'scroll' const fixedEl = fixtureEl.querySelector('#fixed1') const fixedEl2 = fixtureEl.querySelector('#fixed2') @@ -147,7 +147,7 @@ describe('ScrollBar', () => { '
', '' ].join('') - document.documentElement.style.overflowY = 'scroll' + doc.style.overflowY = 'scroll' const stickyTopEl = fixtureEl.querySelector('.sticky-top') const originalMargin = getMarginX(stickyTopEl) @@ -210,7 +210,7 @@ describe('ScrollBar', () => { expect(getPaddingX(stickyEl)).toEqual(scrollBarWidth + originalPadding) const expectedMargin = scrollBarWidth + originalMargin - expect(getMarginX(stickyEl)).toEqual(Math.abs(expectedMargin) === 0 ? expectedMargin : -expectedMargin) + expect(getMarginX(stickyEl)).toEqual(expectedMargin === 0 ? expectedMargin : -expectedMargin) expect(hasMarginAttr(stickyEl)).toBeFalse() // We do not have to keep css margin expect(hasPaddingAttr(stickyEl)).toBeFalse() // We do not have to keep css padding @@ -322,7 +322,6 @@ describe('ScrollBar', () => { it('should not adjust the inline body padding when it does not overflow, even on a scaled display', () => { const originalPadding = getPaddingX(document.body) - const doc = document.documentElement // Remove body margins as would be done by Bootstrap css document.body.style.margin = '0'