aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/dom
diff options
context:
space:
mode:
authorRohit Sharma <[email protected]>2020-11-11 12:07:04 +0530
committerXhmikosR <[email protected]>2020-11-14 07:09:15 +0200
commite530118117af509ffb97029cd250a23ee08120b6 (patch)
treebb541e3d3c692df4391359001a7e679c146bb14c /js/tests/unit/dom
parenta7f04e9595205ed091a5bba71cedc4a80fc4da47 (diff)
downloadbootstrap-e530118117af509ffb97029cd250a23ee08120b6.tar.xz
bootstrap-e530118117af509ffb97029cd250a23ee08120b6.zip
Get only bs prefixed data attributes
Diffstat (limited to 'js/tests/unit/dom')
-rw-r--r--js/tests/unit/dom/manipulator.spec.js20
1 files changed, 2 insertions, 18 deletions
diff --git a/js/tests/unit/dom/manipulator.spec.js b/js/tests/unit/dom/manipulator.spec.js
index 747e8bfd7..4f5ef715e 100644
--- a/js/tests/unit/dom/manipulator.spec.js
+++ b/js/tests/unit/dom/manipulator.spec.js
@@ -60,32 +60,16 @@ describe('Manipulator', () => {
expect().nothing()
})
- it('should get all data attributes, without bs prefixed as well', () => {
- fixtureEl.innerHTML = '<div data-bs-toggle="tabs" data-bs-target="#element" data-another="value"></div>'
+ it('should get only bs prefixed data attributes without bs namespace', () => {
+ fixtureEl.innerHTML = '<div data-bs-toggle="tabs" data-bs-target="#element" data-another="value" data-target-bs="#element" data-in-bs-out="in-between"></div>'
const div = fixtureEl.querySelector('div')
expect(Manipulator.getDataAttributes(div)).toEqual({
- bsToggle: 'tabs',
- bsTarget: '#element',
- another: 'value',
toggle: 'tabs',
target: '#element'
})
})
-
- it('should remove just prefixed bs keyword from the attributes and override original attribute with bs prefixed', () => {
- fixtureEl.innerHTML = '<div data-bs-toggle="tabs" data-toggle="override" data-target-bs="#element" data-in-bs-out="in-between"></div>'
-
- const div = fixtureEl.querySelector('div')
-
- expect(Manipulator.getDataAttributes(div)).toEqual({
- bsToggle: 'tabs',
- targetBs: '#element',
- inBsOut: 'in-between',
- toggle: 'tabs'
- })
- })
})
describe('getDataAttribute', () => {