@@ -862,6 +862,44 @@ $(function () {
862862 . modal ( 'show' )
863863 } )
864864
865+ QUnit . test ( 'should allow to close modal if the tooltip element is detached' , function ( assert ) {
866+ assert . expect ( 1 )
867+ var done = assert . async ( )
868+ var templateHTML = [
869+ '<div id="modal-test" class="modal">' ,
870+ ' <div class="modal-dialog" role="document">' ,
871+ ' <div class="modal-content">' ,
872+ ' <div class="modal-body">' ,
873+ ' <a id="tooltipTest" href="#" data-toggle="tooltip" title="Some tooltip text!">Tooltip</a>' ,
874+ ' </div>' ,
875+ ' </div>' ,
876+ ' </div>' ,
877+ '</div>'
878+ ] . join ( '' )
879+
880+ $ ( templateHTML ) . appendTo ( '#qunit-fixture' )
881+ var $tooltip = $ ( '#tooltipTest' )
882+ var $modal = $ ( '#modal-test' )
883+
884+ $tooltip . on ( 'shown.bs.tooltip' , function ( ) {
885+ $tooltip . detach ( )
886+ $tooltip . bootstrapTooltip ( 'dispose' )
887+ $modal . modal ( 'hide' )
888+ } )
889+
890+ $modal . on ( 'shown.bs.modal' , function ( ) {
891+ $tooltip . bootstrapTooltip ( {
892+ trigger : 'manuel'
893+ } )
894+ . bootstrapTooltip ( 'show' )
895+ } )
896+ . on ( 'hidden.bs.modal' , function ( ) {
897+ assert . ok ( true , 'modal hidden' )
898+ done ( )
899+ } )
900+ . modal ( 'show' )
901+ } )
902+
865903 QUnit . test ( 'should reset tip classes when hidden event triggered' , function ( assert ) {
866904 assert . expect ( 2 )
867905 var done = assert . async ( )
@@ -966,4 +1004,24 @@ $(function () {
9661004
9671005 assert . ok ( tooltip . tip === $tipTest [ 0 ] )
9681006 } )
1007+
1008+ QUnit . test ( 'should toggle enabled' , function ( assert ) {
1009+ assert . expect ( 3 )
1010+
1011+ var $tooltip = $ ( '<a href="#" rel="tooltip" data-trigger="click" title="Another tooltip"/>' )
1012+ . appendTo ( '#qunit-fixture' )
1013+ . bootstrapTooltip ( )
1014+
1015+ var tooltip = $tooltip . data ( 'bs.tooltip' )
1016+
1017+ assert . strictEqual ( tooltip . _isEnabled , true )
1018+
1019+ tooltip . toggleEnabled ( )
1020+
1021+ assert . strictEqual ( tooltip . _isEnabled , false )
1022+
1023+ tooltip . toggleEnabled ( )
1024+
1025+ assert . strictEqual ( tooltip . _isEnabled , true )
1026+ } )
9691027} )
0 commit comments