aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/tooltip.spec.js
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-01 15:10:10 +0200
committerGitHub <[email protected]>2021-12-01 15:10:10 +0200
commitcab62af2e6ecddbadbf799e00f911c2b342d93b2 (patch)
treec6fe4cb85a888bf8395f2fc3069f5a5b63ece023 /js/tests/unit/tooltip.spec.js
parent44a6cd724c0a5c5247492fdb8db7d4df4705641e (diff)
downloadbootstrap-cab62af2e6ecddbadbf799e00f911c2b342d93b2.tar.xz
bootstrap-cab62af2e6ecddbadbf799e00f911c2b342d93b2.zip
Fix popover arrow & tooltip template after the `setContent` addition (#35441)
Diffstat (limited to 'js/tests/unit/tooltip.spec.js')
-rw-r--r--js/tests/unit/tooltip.spec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js
index 19eeca2f5..d261986c3 100644
--- a/js/tests/unit/tooltip.spec.js
+++ b/js/tests/unit/tooltip.spec.js
@@ -1081,6 +1081,21 @@ describe('Tooltip', () => {
expect(tip()).not.toHaveClass('show')
expect(tip().querySelector('.tooltip-inner').textContent).toEqual('foo')
})
+
+ it('"setContent" should keep the initial template', () => {
+ fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">'
+
+ const tooltipEl = fixtureEl.querySelector('a')
+ const tooltip = new Tooltip(tooltipEl)
+
+ tooltip.setContent({ '.tooltip-inner': 'foo' })
+ const tip = tooltip.getTipElement()
+
+ expect(tip).toHaveClass('tooltip')
+ expect(tip).toHaveClass('bs-tooltip-auto')
+ expect(tip.querySelector('.tooltip-arrow')).not.toBeNull()
+ expect(tip.querySelector('.tooltip-inner')).not.toBeNull()
+ })
})
describe('setContent', () => {