mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-15 18:14:17 +02:00
Get only bs prefixed data attributes
This commit is contained in:
@@ -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', () => {
|
||||
|
Reference in New Issue
Block a user