From 297c47c3fdbb58e3d9824afdee83ef3c4b9d141a Mon Sep 17 00:00:00 2001 From: Johann Date: Fri, 2 Dec 2016 18:52:19 +0100 Subject: [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 --- js/tests/visual/modal.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'js/tests/visual/modal.html') diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index fa5bd368a..69d392350 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -188,6 +188,26 @@ } } + // Should throw an error because modal is in transition + function testModalTransitionError() { + var err = false + // Close #myModal + $('#myModal').on('shown.bs.modal', function () { + $('#myModal').modal('hide').off('shown.bs.modal') + if (!err) { + alert('No error thrown for : testModalTransitionError') + } + }) + + try { + $('#myModal').modal('show').modal('hide') + } + catch (e) { + err = true + console.error(e.message) + } + } + $(function () { $('[data-toggle="popover"]').popover() $('[data-toggle="tooltip"]').tooltip() @@ -200,6 +220,7 @@ $('#firefoxModal').on('focus', reportFirefoxTestResult.bind(false)) $('#ff-bug-input').on('focus', reportFirefoxTestResult.bind(true)) }) + testModalTransitionError() }) -- cgit v1.2.3