File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -739,4 +739,40 @@ $(function () {
739
739
$tooltip . trigger ( 'mouseenter' )
740
740
} )
741
741
742
+ test ( 'should correctly position tooltips on SVG elements' , function ( ) {
743
+ if ( ! window . SVGElement ) {
744
+ // Skip IE8 since it doesn't support SVG
745
+ expect ( 0 )
746
+ return
747
+ }
748
+
749
+ stop ( )
750
+
751
+ var styles = '<style>'
752
+ + '.tooltip, .tooltip *, .tooltip *:before, .tooltip *:after { box-sizing: border-box; }'
753
+ + '.tooltip { position: absolute; }'
754
+ + '.tooltip .tooltip-inner { width: 24px; height: 24px; font-family: Helvetica; }'
755
+ + '</style>'
756
+ var $styles = $ ( styles ) . appendTo ( 'head' )
757
+
758
+ $ ( '#qunit-fixture' ) . append (
759
+ '<div style="position: fixed; top: 0; left: 0;">'
760
+ + ' <svg width="200" height="200">'
761
+ + ' <circle cx="100" cy="100" r="10" title="m" id="theCircle" />'
762
+ + ' </svg>'
763
+ + '</div>' )
764
+ var $circle = $ ( '#theCircle' )
765
+
766
+ $circle
767
+ . on ( 'shown.bs.tooltip' , function ( ) {
768
+ var offset = $ ( '.tooltip' ) . offset ( )
769
+ $styles . remove ( )
770
+ ok ( Math . abs ( offset . left - 88 ) <= 1 , 'tooltip has correct horizontal location' )
771
+ start ( )
772
+ } )
773
+ . bootstrapTooltip ( { container : 'body' , placement : 'top' , trigger : 'manual' } )
774
+
775
+ $circle . bootstrapTooltip ( 'show' )
776
+ } )
777
+
742
778
} )
You can’t perform that action at this time.
0 commit comments