mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 00:54:04 +02:00
Tooltip: remove title attribute before show & add tests (#35456)
This commit is contained in:
@@ -180,6 +180,15 @@ describe('Tooltip', () => {
|
||||
expect(getPopperConfig).toHaveBeenCalled()
|
||||
expect(popperConfig.placement).toEqual('left')
|
||||
})
|
||||
|
||||
it('should use original title, if not "data-bs-title" is given', () => {
|
||||
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>'
|
||||
|
||||
const tooltipEl = fixtureEl.querySelector('a')
|
||||
const tooltip = new Tooltip(tooltipEl)
|
||||
|
||||
expect(tooltip._config.title).toEqual('Another tooltip')
|
||||
})
|
||||
})
|
||||
|
||||
describe('enable', () => {
|
||||
@@ -855,6 +864,19 @@ describe('Tooltip', () => {
|
||||
|
||||
tooltip.show()
|
||||
})
|
||||
|
||||
it('should remove `title` attribute if exists', done => {
|
||||
fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>'
|
||||
|
||||
const tooltipEl = fixtureEl.querySelector('a')
|
||||
const tooltip = new Tooltip(tooltipEl)
|
||||
|
||||
tooltipEl.addEventListener('shown.bs.tooltip', () => {
|
||||
expect(tooltipEl.getAttribute('title')).toBeNull()
|
||||
done()
|
||||
})
|
||||
tooltip.show()
|
||||
})
|
||||
})
|
||||
|
||||
describe('hide', () => {
|
||||
|
Reference in New Issue
Block a user