1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-17 11:00:56 +02:00

Add a template factory helper to handle all template cases (#34519)

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
GeoSot
2021-11-25 19:14:02 +02:00
committed by GitHub
parent fa33e83f25
commit 94a596fbcb
10 changed files with 606 additions and 131 deletions

View File

@@ -162,8 +162,8 @@ describe('Popover', () => {
const popover = new Popover(popoverEl, {
content: 'Popover content'
})
const spy = spyOn(popover, 'setContent').and.callThrough()
expect(popover._templateFactory).toBeNull()
let spy = null
let times = 1
popoverEl.addEventListener('hidden.bs.popover', () => {
@@ -171,11 +171,12 @@ describe('Popover', () => {
})
popoverEl.addEventListener('shown.bs.popover', () => {
spy = spy || spyOn(popover._templateFactory, 'constructor').and.callThrough()
const popoverDisplayed = document.querySelector('.popover')
expect(popoverDisplayed).not.toBeNull()
expect(popoverDisplayed.querySelector('.popover-body').textContent).toEqual('Popover content')
expect(spy).toHaveBeenCalledTimes(1)
expect(spy).toHaveBeenCalledTimes(0)
if (times > 1) {
done()
}