1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-29 06:49:06 +02:00

[V4] Throw error when a plugin is in transition (#17823)

* Throw error when a plugin is in transition
* Add unit tests about plugins in transition
This commit is contained in:
Johann
2016-12-02 18:52:19 +01:00
committed by Mark Otto
parent 1fb6d8c46a
commit 297c47c3fd
8 changed files with 144 additions and 23 deletions

View File

@@ -112,8 +112,11 @@ const Collapse = (($) => {
}
show() {
if (this._isTransitioning ||
$(this._element).hasClass(ClassName.ACTIVE)) {
if (this._isTransitioning) {
throw new Error('Collapse is transitioning')
}
if ($(this._element).hasClass(ClassName.ACTIVE)) {
return
}
@@ -193,8 +196,11 @@ const Collapse = (($) => {
}
hide() {
if (this._isTransitioning ||
!$(this._element).hasClass(ClassName.ACTIVE)) {
if (this._isTransitioning) {
throw new Error('Collapse is transitioning')
}
if (!$(this._element).hasClass(ClassName.ACTIVE)) {
return
}