1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-13 09:04:14 +02:00

ScrollSpy: Make Proper use of the SelectorEngine

* avoid extra work, creating ids
* simplify selectors and constrain search inside `config.target`
This commit is contained in:
GeoSot
2021-06-08 10:38:27 +03:00
committed by Mark Otto
parent a816615efa
commit f94f497ad5
2 changed files with 8 additions and 36 deletions

View File

@@ -65,21 +65,6 @@ describe('ScrollSpy', () => {
expect(sSpyByElement._element).toEqual(sSpyEl)
})
it('should generate an id when there is not one', () => {
fixtureEl.innerHTML = [
'<nav></nav>',
'<div class="content"></div>'
].join('')
const navEl = fixtureEl.querySelector('nav')
const scrollSpy = new ScrollSpy(fixtureEl.querySelector('.content'), {
target: navEl
})
expect(scrollSpy).toBeDefined()
expect(navEl.getAttribute('id')).not.toEqual(null)
})
it('should not process element without target', () => {
fixtureEl.innerHTML = [
'<nav id="navigation" class="navbar">',