mirror of
https://github.com/tabler/tabler.git
synced 2026-10-12 05:06:55 +04:00
Fix data attributes written with data-tblr- instead of data-bs- (#3219)
This commit is contained in:
1 parent
e3da90ecb6
commit
29818fcc83
4 files changed
+11
-7
No files matched your search
@@ -43,7 +43,7 @@ const PREFIXES = ['tblr', 'bs'] as const
|
||||
|
||||
const Manipulator = {
|
||||
setDataAttribute(element: HTMLElement, key: string, value: string): void {
|
||||
element.setAttribute(`data-tblr-${normalizeDataKey(key)}`, value)
|
||||
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)
|
||||
},
|
||||
|
||||
removeDataAttribute(element: HTMLElement, key: string): void {
|
||||
|
||||
@@ -20,23 +20,23 @@ describe('Manipulator', () => {
|
||||
})
|
||||
|
||||
describe('setDataAttribute', () => {
|
||||
it('should set a data-tblr-* attribute', () => {
|
||||
it('should set a data-bs-* attribute', () => {
|
||||
Manipulator.setDataAttribute(div, 'key', 'value')
|
||||
|
||||
expect(div.getAttribute('data-tblr-key')).toBe('value')
|
||||
expect(div.getAttribute('data-bs-key')).toBe('value')
|
||||
})
|
||||
|
||||
it('should convert camelCase keys to kebab-case', () => {
|
||||
Manipulator.setDataAttribute(div, 'testKey', '123')
|
||||
|
||||
expect(div.getAttribute('data-tblr-test-key')).toBe('123')
|
||||
expect(div.getAttribute('data-bs-test-key')).toBe('123')
|
||||
})
|
||||
|
||||
it('should overwrite existing value', () => {
|
||||
Manipulator.setDataAttribute(div, 'key', 'old')
|
||||
Manipulator.setDataAttribute(div, 'key', 'new')
|
||||
|
||||
expect(div.getAttribute('data-tblr-key')).toBe('new')
|
||||
expect(div.getAttribute('data-bs-key')).toBe('new')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -660,8 +660,7 @@ Navbar vertical
|
||||
// The sidebar is rendered for the expanded state, so the active submenu can
|
||||
// arrive open (.show). Folded, it would paint as a flyout until sidebar.ts
|
||||
// closes it on DOMContentLoaded — a flicker on every reload. Menus opened by
|
||||
// the Dropdown plugin carry a popper data attribute (data-tblr-popper from
|
||||
// tabler.js, data-bs-popper from Bootstrap's own js), so only the
|
||||
// the Dropdown plugin carry a data-bs-popper attribute, so only the
|
||||
// server-rendered ones hide.
|
||||
.navbar-vertical .dropdown-menu.show:not([data-bs-popper]):not([data-tblr-popper]) {
|
||||
display: none;
|
||||
|
||||
Reference in new issue
Block a user