aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/tooltip.js
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-04-10 09:28:29 +0200
committerGitHub <[email protected]>2018-04-10 09:28:29 +0200
commit0871d69ec975b51472a451ed63ffa2af874606d2 (patch)
tree977e0bcbcde804c5a90da0fc28db41a6748b8b82 /js/tests/unit/tooltip.js
parent875ed0b975a587fffcc1b0c632e1cc8f612ebc5a (diff)
downloadbootstrap-0871d69ec975b51472a451ed63ffa2af874606d2.tar.xz
bootstrap-0871d69ec975b51472a451ed63ffa2af874606d2.zip
v4 improve coverage (#25945)
* Improve code coverage for our Button plugin * improve coverage for our Alert plugin * test tooltip update method * test update and dispose for dropdown * increase code coverage requirements
Diffstat (limited to 'js/tests/unit/tooltip.js')
-rw-r--r--js/tests/unit/tooltip.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 20d022c5d..a2a239530 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -953,4 +953,33 @@ $(function () {
$trigger.trigger($.Event('click'))
}, 200)
})
+
+ QUnit.test('should call Popper.js to update', function (assert) {
+ assert.expect(2)
+
+ var $tooltip = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
+ .appendTo('#qunit-fixture')
+ .bootstrapTooltip()
+
+ var tooltip = $tooltip.data('bs.tooltip')
+ tooltip.show()
+ assert.ok(tooltip._popper)
+
+ var spyPopper = sinon.spy(tooltip._popper, 'scheduleUpdate')
+ tooltip.update()
+ assert.ok(spyPopper.called)
+ })
+
+ QUnit.test('should not call Popper.js to update', function (assert) {
+ assert.expect(1)
+
+ var $tooltip = $('<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>')
+ .appendTo('#qunit-fixture')
+ .bootstrapTooltip()
+
+ var tooltip = $tooltip.data('bs.tooltip')
+ tooltip.update()
+
+ assert.ok(tooltip._popper === null)
+ })
})