aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-02-16 08:58:08 +0200
committerGitHub <[email protected]>2021-02-16 08:58:08 +0200
commit3602828a9001298fcfb6638041fc300f9e677bcb (patch)
treebba32ebd7deb762c15ec36d15e4257d397874516 /js/tests/unit
parent4d19e0e8a49e887f007a1e5a147d900d15f61a9c (diff)
downloadbootstrap-3602828a9001298fcfb6638041fc300f9e677bcb.tar.xz
bootstrap-3602828a9001298fcfb6638041fc300f9e677bcb.zip
Add tests for `DATA_KEY` (#33090)
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/alert.spec.js6
-rw-r--r--js/tests/unit/button.spec.js6
-rw-r--r--js/tests/unit/carousel.spec.js6
-rw-r--r--js/tests/unit/collapse.spec.js6
-rw-r--r--js/tests/unit/dropdown.spec.js6
-rw-r--r--js/tests/unit/modal.spec.js6
-rw-r--r--js/tests/unit/scrollspy.spec.js6
-rw-r--r--js/tests/unit/toast.spec.js6
8 files changed, 48 insertions, 0 deletions
diff --git a/js/tests/unit/alert.spec.js b/js/tests/unit/alert.spec.js
index a1322f1c7..916c7fd07 100644
--- a/js/tests/unit/alert.spec.js
+++ b/js/tests/unit/alert.spec.js
@@ -19,6 +19,12 @@ describe('Alert', () => {
expect(typeof Alert.VERSION).toEqual('string')
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Alert.DATA_KEY).toEqual('bs.alert')
+ })
+ })
+
describe('data-api', () => {
it('should close an alert without instantiating it manually', () => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/button.spec.js b/js/tests/unit/button.spec.js
index 51aa73774..e442fd90d 100644
--- a/js/tests/unit/button.spec.js
+++ b/js/tests/unit/button.spec.js
@@ -24,6 +24,12 @@ describe('Button', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Button.DATA_KEY).toEqual('bs.button')
+ })
+ })
+
describe('data-api', () => {
it('should toggle active class on click', () => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js
index 2f47f2e00..533e1ba7e 100644
--- a/js/tests/unit/carousel.spec.js
+++ b/js/tests/unit/carousel.spec.js
@@ -45,6 +45,12 @@ describe('Carousel', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Carousel.DATA_KEY).toEqual('bs.carousel')
+ })
+ })
+
describe('constructor', () => {
it('should go to next item if right arrow key is pressed', done => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/collapse.spec.js b/js/tests/unit/collapse.spec.js
index ff493cf51..cd30ed8da 100644
--- a/js/tests/unit/collapse.spec.js
+++ b/js/tests/unit/collapse.spec.js
@@ -27,6 +27,12 @@ describe('Collapse', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Collapse.DATA_KEY).toEqual('bs.collapse')
+ })
+ })
+
describe('constructor', () => {
it('should allow jquery object in parent config', () => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js
index 04c35059e..658cb65b0 100644
--- a/js/tests/unit/dropdown.spec.js
+++ b/js/tests/unit/dropdown.spec.js
@@ -33,6 +33,12 @@ describe('Dropdown', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Dropdown.DATA_KEY).toEqual('bs.dropdown')
+ })
+ })
+
describe('constructor', () => {
it('should add a listener on trigger which do not have data-bs-toggle="dropdown"', () => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js
index 29c90bbf1..8a159eef6 100644
--- a/js/tests/unit/modal.spec.js
+++ b/js/tests/unit/modal.spec.js
@@ -56,6 +56,12 @@ describe('Modal', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Modal.DATA_KEY).toEqual('bs.modal')
+ })
+ })
+
describe('toggle', () => {
it('should toggle a modal', done => {
fixtureEl.innerHTML = '<div class="modal"><div class="modal-dialog"></div></div>'
diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js
index 917593f39..a00da485f 100644
--- a/js/tests/unit/scrollspy.spec.js
+++ b/js/tests/unit/scrollspy.spec.js
@@ -47,6 +47,12 @@ describe('ScrollSpy', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(ScrollSpy.DATA_KEY).toEqual('bs.scrollspy')
+ })
+ })
+
describe('constructor', () => {
it('should generate an id when there is not one', () => {
fixtureEl.innerHTML = [
diff --git a/js/tests/unit/toast.spec.js b/js/tests/unit/toast.spec.js
index 44f74aa36..f8ef6e54b 100644
--- a/js/tests/unit/toast.spec.js
+++ b/js/tests/unit/toast.spec.js
@@ -20,6 +20,12 @@ describe('Toast', () => {
})
})
+ describe('DATA_KEY', () => {
+ it('should return plugin data key', () => {
+ expect(Toast.DATA_KEY).toEqual('bs.toast')
+ })
+ })
+
describe('constructor', () => {
it('should allow to config in js', done => {
fixtureEl.innerHTML = [