From 95ce03f000d663a22f91d22d490fdd7157183726 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Thu, 29 Dec 2016 10:40:32 +0100 Subject: [PATCH] Close #21249 : Add a Unit test for #21227 --- js/tests/unit/popover.js | 32 ++++++++++++++++++++++++++++++++ js/tests/unit/tooltip.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) 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') + }) })