aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorMu-An Chiou <[email protected]>2013-06-28 11:05:38 +0100
committerMu-An Chiou <[email protected]>2013-06-28 11:05:38 +0100
commit55fa1acbd6f351d56b873eef6c59f72899cece49 (patch)
tree2e293fdee22a4581feff6986bda1c1dd02e08e7a /js/tests
parent09cdee2f03aaad5c5a767fbec2e3896ad3d1f980 (diff)
downloadbootstrap-55fa1acbd6f351d56b873eef6c59f72899cece49.tar.xz
bootstrap-55fa1acbd6f351d56b873eef6c59f72899cece49.zip
Tooltip: apply position class before positioning
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/tooltip.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 638edefc2..b1bf75e55 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -291,4 +291,18 @@ $(function () {
container.remove()
}, 100)
})
+
+ test("should add position class before positioning so that position-specific styles are taken into account", function(){
+ $("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>')
+
+ var container = $("<div />").appendTo("body")
+ , target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line">To my right</a>')
+ .appendTo(container)
+ .tooltip({placement: 'right'})
+ .tooltip('show')
+ , tooltip = container.find(".tooltip")
+
+ ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === tooltip.offset().top )
+ target.tooltip('hide')
+ })
})