aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/scrollspy.spec.js
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2019-09-04 17:58:29 +0300
committerXhmikosR <[email protected]>2020-11-29 20:58:26 +0200
commit9f6b342dc710e4334b37ded90136efa1127a47cd (patch)
treecb5d8c8bddf356dd3f8c2289b99e9f9793fba6c7 /js/tests/unit/scrollspy.spec.js
parentc63aebc86ba05f0ebb420add653b80804c6a0cff (diff)
downloadbootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.tar.xz
bootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.zip
create a base component
Diffstat (limited to 'js/tests/unit/scrollspy.spec.js')
-rw-r--r--js/tests/unit/scrollspy.spec.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js
index 33298300c..303a336f4 100644
--- a/js/tests/unit/scrollspy.spec.js
+++ b/js/tests/unit/scrollspy.spec.js
@@ -634,6 +634,16 @@ describe('ScrollSpy', () => {
})
describe('getInstance', () => {
+ it('should return scrollspy instance', () => {
+ fixtureEl.innerHTML = '<div></div>'
+
+ const div = fixtureEl.querySelector('div')
+ const scrollSpy = new ScrollSpy(div)
+
+ expect(ScrollSpy.getInstance(div)).toEqual(scrollSpy)
+ expect(ScrollSpy.getInstance(div) instanceof ScrollSpy).toEqual(true)
+ })
+
it('should return null if there is no instance', () => {
expect(ScrollSpy.getInstance(fixtureEl)).toEqual(null)
})