diff options
| author | GeoSot <[email protected]> | 2021-12-09 15:05:50 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-09 15:05:50 +0200 |
| commit | 4fd5539c75515527cb1335c31bbaf76209aab296 (patch) | |
| tree | a5470adbaf027e33bf10ddf1ec92e3454440611b /js/tests | |
| parent | 2a7015e630e575ed39508c7aa51e8a085922e9e9 (diff) | |
| download | bootstrap-4fd5539c75515527cb1335c31bbaf76209aab296.tar.xz bootstrap-4fd5539c75515527cb1335c31bbaf76209aab296.zip | |
ScrollBar.js. Minor refactoring and add test (#35492)
Diffstat (limited to 'js/tests')
| -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 15f09c0b2..fc3a6f4e8 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">', |
