From: Johann-S Date: Thu, 29 Dec 2016 09:40:32 +0000 (+0100) Subject: Close #21249 : Add a Unit test for #21227 X-Git-Tag: v4.0.0-alpha.6~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95ce03f000d663a22f91d22d490fdd7157183726;p=thirdparty%2Fbootstrap.git Close #21249 : Add a Unit test for #21227 --- diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 5452def585..64c8c556ac 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -332,4 +332,36 @@ $(function () { done() } }) + + QUnit.test('should hide popovers when their containing modal is closed', function (assert) { + assert.expect(1) + var done = assert.async() + var templateHTML = '' + + $(templateHTML).appendTo('#qunit-fixture') + $('#popover-test') + .on('shown.bs.popover', function () { + $('#modal-test').modal('hide') + }) + .on('hide.bs.popover', function () { + assert.ok(true, 'popover hide') + done() + }) + + $('#modal-test') + .on('shown.bs.modal', function () { + $('#popover-test').bootstrapPopover('show') + }) + .modal('show') + }) }) diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 7ff967fabc..e1aec5551f 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -839,4 +839,34 @@ $(function () { assert.ok(showingTooltip(), 'tooltip is faded in again') }) + QUnit.test('should hide tooltip when their containing modal is closed', function (assert) { + assert.expect(1) + var done = assert.async() + var templateHTML = '' + + $(templateHTML).appendTo('#qunit-fixture') + $('#tooltipTest') + .bootstrapTooltip({ trigger: 'manuel' }) + .on('shown.bs.tooltip', function () { + $('#modal-test').modal('hide') + }) + .on('hide.bs.tooltip', function () { + assert.ok(true, 'tooltip hide') + done() + }) + + $('#modal-test') + .on('shown.bs.modal', function () { + $('#tooltipTest').bootstrapTooltip('show') + }) + .modal('show') + }) })