Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-12-09 16:05:50 +0300
committerGitHub <noreply@github.com>2021-12-09 16:05:50 +0300
commit4fd5539c75515527cb1335c31bbaf76209aab296 (patch)
treea5470adbaf027e33bf10ddf1ec92e3454440611b /js/tests/unit/util
parent2a7015e630e575ed39508c7aa51e8a085922e9e9 (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.js21
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">',