diff options
author | GeoSot <geo.sotis@gmail.com> | 2022-09-27 10:39:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 10:39:11 +0300 |
commit | 597c4023141dc48868889b85676b2d7269411d23 (patch) | |
tree | e4ab90fa59bd98daaaa69942c3564706b962268b /js/tests | |
parent | e77367dddc1a523b6a7197735dbef7cd63d62fe9 (diff) |
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.
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/dropdown.spec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index ea7ddace30..2bbd7c00a7 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -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 = [ |