mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 00:24:03 +02:00
Dropdown: fix case with invalid markup (#37190)
This fixes a backward incompatible change in v5.2.1 where `.drodown-toggle` isn't present in the markup.
This commit is contained in:
@@ -57,6 +57,28 @@ describe('Dropdown', () => {
|
||||
expect(dropdownByElement._element).toEqual(btnDropdown)
|
||||
})
|
||||
|
||||
it('should work on invalid markup', () => {
|
||||
return new Promise(resolve => {
|
||||
// TODO: REMOVE in v6
|
||||
fixtureEl.innerHTML = [
|
||||
'<div class="dropdown">',
|
||||
' <div class="dropdown-menu">',
|
||||
' <a class="dropdown-item" href="#">Link</a>',
|
||||
' </div>',
|
||||
'</div>'
|
||||
].join('')
|
||||
|
||||
const dropdownElem = fixtureEl.querySelector('.dropdown-menu')
|
||||
const dropdown = new Dropdown(dropdownElem)
|
||||
|
||||
dropdownElem.addEventListener('shown.bs.dropdown', () => {
|
||||
resolve()
|
||||
})
|
||||
|
||||
dropdown.show()
|
||||
})
|
||||
})
|
||||
|
||||
it('should create offset modifier correctly when offset option is a function', () => {
|
||||
return new Promise(resolve => {
|
||||
fixtureEl.innerHTML = [
|
||||
|
Reference in New Issue
Block a user