2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03: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
+10 -4
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
}