1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 00:24:03 +02:00

Tooltip: apply position class before positioning

This commit is contained in:
Mu-An Chiou
2013-06-28 11:05:38 +01:00
parent 09cdee2f03
commit 55fa1acbd6
4 changed files with 17 additions and 3 deletions

View File

@@ -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')
})
})