0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Scrollspy: enable smooth-scroll behavior (#36528)

This commit is contained in:
GeoSot 2022-06-08 22:35:09 +03:00 committed by GitHub
parent 90021886f6
commit 37cf7d11b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -128,7 +128,7 @@ class ScrollSpy extends BaseComponent {
const root = this._rootElement || window
const height = observableSection.offsetTop - this._element.offsetTop
if (root.scrollTo) {
root.scrollTo({ top: height })
root.scrollTo({ top: height, behavior: 'smooth' })
return
}

View File

@ -889,7 +889,7 @@ describe('ScrollSpy', () => {
setTimeout(() => {
if (div.scrollTo) {
expect(clickSpy).toHaveBeenCalledWith({ top: observable.offsetTop - div.offsetTop })
expect(clickSpy).toHaveBeenCalledWith({ top: observable.offsetTop - div.offsetTop, behavior: 'smooth' })
} else {
expect(clickSpy).toHaveBeenCalledWith(observable.offsetTop - div.offsetTop)
}