aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/tooltip.js
diff options
context:
space:
mode:
authorAlexandr Kondrashov <[email protected]>2015-09-11 16:43:00 +0300
committerAlexandr Kondrashov <[email protected]>2015-09-11 16:43:00 +0300
commitc9725926b2f30bed4e37f57c20ef8ffeb2fd233b (patch)
tree2964ad7556549dd3e0712bdfdbc5fc4ae7a9b45f /js/tests/unit/tooltip.js
parent353e0a49a97c24d89f6cdb95014419d4137dee6e (diff)
parentb811f8cf9628dbcbfe994f71588c5a0c921a092d (diff)
downloadbootstrap-c9725926b2f30bed4e37f57c20ef8ffeb2fd233b.tar.xz
bootstrap-c9725926b2f30bed4e37f57c20ef8ffeb2fd233b.zip
Merge remote-tracking branch 'twbs/v4-dev' into patch-1
Conflicts: scss/_custom-forms.scss scss/_variables.scss
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 f4deb29f8..934e26b9e 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -119,6 +119,35 @@ $(function () {
assert.strictEqual($tooltip.data('bs.tooltip').tip.parentNode, null, 'tooltip removed')
})
+ QUnit.test('should allow DOMElement title (html: false)', function (assert) {
+ assert.expect(3)
+ var title = document.createTextNode('<3 writing tests')
+ var $tooltip = $('<a href="#" rel="tooltip"/>')
+ .appendTo('#qunit-fixture')
+ .bootstrapTooltip({ title: title })
+
+ $tooltip.bootstrapTooltip('show')
+
+ assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
+ assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
+ assert.ok(!$.contains($('.tooltip').get(0), title), 'title node copied, not moved')
+ })
+
+ QUnit.test('should allow DOMElement title (html: true)', function (assert) {
+ assert.expect(3)
+ var title = document.createTextNode('<3 writing tests')
+ var $tooltip = $('<a href="#" rel="tooltip"/>')
+ .appendTo('#qunit-fixture')
+ .bootstrapTooltip({ html: true, title: title })
+
+ $tooltip.bootstrapTooltip('show')
+
+ assert.notEqual($('.tooltip').length, 0, 'tooltip inserted')
+ assert.strictEqual($('.tooltip').text(), '<3 writing tests', 'title inserted')
+ assert.ok($.contains($('.tooltip').get(0), title), 'title node moved, not copied')
+ })
+
+
QUnit.test('should respect custom classes', function (assert) {
assert.expect(2)
var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')