]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add tests for `DATA_KEY` (#33090)
authorGeoSot <geo.sotis@gmail.com>
Tue, 16 Feb 2021 06:58:08 +0000 (08:58 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Feb 2021 06:58:08 +0000 (08:58 +0200)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
js/tests/unit/alert.spec.js
js/tests/unit/button.spec.js
js/tests/unit/carousel.spec.js
js/tests/unit/collapse.spec.js
js/tests/unit/dropdown.spec.js
js/tests/unit/modal.spec.js
js/tests/unit/scrollspy.spec.js
js/tests/unit/toast.spec.js

index a1322f1c7b92e20e2df169580ddd1c7e6917aff8..916c7fd07c6d4eb1e18d30b51fa1aa4033e1ba03 100644 (file)
@@ -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 = [
index 51aa73774c45908f449dfad1e5e71719789300af..e442fd90d0a1b4a299c0544302866dee1d7bc0e2 100644 (file)
@@ -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 = [
index 2f47f2e00d37d217033ef122773ad28ba892135f..533e1ba7e2537625fb3f3d94c2aa971d4bc9cd35 100644 (file)
@@ -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 = [
index ff493cf51aa87fbdeb6fb6d2b78a0950f9ab0112..cd30ed8daa8d247577428cfa30c036918e168128 100644 (file)
@@ -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 = [
index 04c35059e7bee5d49c549ae81b3e4ec730d09ed0..658cb65b04ad0697235fe7b337261d0f38bf54be 100644 (file)
@@ -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 = [
index 29c90bbf12882e0a43367790016a5d09cf4214d7..8a159eef6c984e6b3ff53141dc64225d475627a3 100644 (file)
@@ -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>'
index 917593f3987cd1685c5ee4d24205882b47bc0a32..a00da485f8d28c5d58e5b5775af77eca3c908beb 100644 (file)
@@ -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 = [
index 44f74aa36dab4965b0b952f2916d26c8f12feb49..f8ef6e54b4bd6fa30c7ddb6968117d704822c3cf 100644 (file)
@@ -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 = [