diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-12-09 16:05:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 16:05:50 +0300 |
commit | 4fd5539c75515527cb1335c31bbaf76209aab296 (patch) | |
tree | a5470adbaf027e33bf10ddf1ec92e3454440611b /js/tests/unit/util | |
parent | 2a7015e630e575ed39508c7aa51e8a085922e9e9 (diff) |
ScrollBar.js. Minor refactoring and add test (#35492)
Diffstat (limited to 'js/tests/unit/util')
-rw-r--r-- | js/tests/unit/util/scrollbar.spec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/tests/unit/util/scrollbar.spec.js b/js/tests/unit/util/scrollbar.spec.js index 15f09c0b22..fc3a6f4e87 100644 --- a/js/tests/unit/util/scrollbar.spec.js +++ b/js/tests/unit/util/scrollbar.spec.js @@ -137,6 +137,27 @@ describe('ScrollBar', () => { done() }) + it('should remove padding & margin if not existed before adjustment', done => { + fixtureEl.innerHTML = [ + '<div style="height: 110vh; width: 100%">', + ' <div class="fixed" id="fixed" style="width: 100vw;"></div>', + ' <div class="sticky-top" id="sticky" style=" width: 100vw;"></div>', + '</div>' + ].join('') + doc.style.overflowY = 'scroll' + + const fixedEl = fixtureEl.querySelector('#fixed') + const stickyEl = fixtureEl.querySelector('#sticky') + const scrollBar = new ScrollBarHelper() + + scrollBar.hide() + scrollBar.reset() + + expect(fixedEl.getAttribute('style').includes('padding-right')).toBeFalse() + expect(stickyEl.getAttribute('style').includes('margin-right')).toBeFalse() + done() + }) + it('should adjust the inline margin and padding of sticky elements', done => { fixtureEl.innerHTML = [ '<div style="height: 110vh">', |