aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-04-06 18:28:10 +0300
committerGitHub <[email protected]>2021-04-06 18:28:10 +0300
commit0b34ff2faedb0f5f13d91d279dbe3f8b3ae1fda7 (patch)
tree9a35459b22fe2be01a62adb8118fd907d1456344 /js/tests/unit
parent4fc93866961722fe727b1f206645f7cf5c1dee7e (diff)
downloadbootstrap-0b34ff2faedb0f5f13d91d279dbe3f8b3ae1fda7.tar.xz
bootstrap-0b34ff2faedb0f5f13d91d279dbe3f8b3ae1fda7.zip
Simplify ScrollSpy config (#33250)
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/scrollspy.spec.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js
index f7258ba35..c4130a1aa 100644
--- a/js/tests/unit/scrollspy.spec.js
+++ b/js/tests/unit/scrollspy.spec.js
@@ -605,6 +605,23 @@ describe('ScrollSpy', () => {
expect(ScrollSpy.getInstance(div)).toBeDefined()
})
+ it('should create a scrollspy with given config', () => {
+ fixtureEl.innerHTML = '<div></div>'
+
+ const div = fixtureEl.querySelector('div')
+
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
+ jQueryMock.elements = [div]
+
+ jQueryMock.fn.scrollspy.call(jQueryMock, { offset: 15 })
+ spyOn(ScrollSpy.prototype, 'constructor')
+ expect(ScrollSpy.prototype.constructor).not.toHaveBeenCalledWith(div, { offset: 15 })
+
+ const scrollspy = ScrollSpy.getInstance(div)
+ expect(scrollspy).toBeDefined()
+ expect(scrollspy._config.offset).toBe(15)
+ })
+
it('should not re create a scrollspy', () => {
fixtureEl.innerHTML = '<div></div>'