mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-05-04 02:34:41 +00:00
Unit test for replacing tooltip inside window
This commit is contained in:
parent
6803ff70f9
commit
929598784f
2 changed files with 19 additions and 1 deletions
2
js/bootstrap-tooltip.js
vendored
2
js/bootstrap-tooltip.js
vendored
|
|
@ -190,7 +190,7 @@
|
||||||
|
|
||||||
if (offset.left < 0){
|
if (offset.left < 0){
|
||||||
delta = -offset.left * 2;
|
delta = -offset.left * 2;
|
||||||
offset.left = 0;
|
offset.left = .1;
|
||||||
$tip.offset(offset);
|
$tip.offset(offset);
|
||||||
actualWidth = $tip[0].offsetWidth;
|
actualWidth = $tip[0].offsetWidth;
|
||||||
actualHeight = $tip[0].offsetHeight;
|
actualHeight = $tip[0].offsetHeight;
|
||||||
|
|
|
||||||
18
js/tests/unit/bootstrap-tooltip.js
vendored
18
js/tests/unit/bootstrap-tooltip.js
vendored
|
|
@ -251,4 +251,22 @@ $(function () {
|
||||||
ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent')
|
ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent')
|
||||||
tooltip.tooltip('hide')
|
tooltip.tooltip('hide')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should place tooltip inside window", function(){
|
||||||
|
$("#qunit-fixture").show();
|
||||||
|
var tooltip = $("<a href='#' title='Very very very very very very very very long tooltip'></a>")
|
||||||
|
.css({position: "absolute", top:0, left: 0})
|
||||||
|
.appendTo("#qunit-fixture")
|
||||||
|
.tooltip({placement: "top"})
|
||||||
|
.tooltip("show");
|
||||||
|
|
||||||
|
stop();
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
ok($(".tooltip").offset().left >= 0);
|
||||||
|
|
||||||
|
start();
|
||||||
|
$("#qunit-fixture").hide();
|
||||||
|
}, 200)
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue