@@ -252,6 +252,43 @@ define(["pat-tooltip", "pat-inject"], function(pattern, inject) {
252252 } ) ;
253253 } ) ;
254254 } ) ;
255+
256+ describe ( "A tooltip that opens on click and contains another tooltip trigger" , function ( ) {
257+ beforeEach ( function ( ) {
258+ utils . createTooltip ( {
259+ data : "trigger: click; source: content" ,
260+ href : "#tooltip-content"
261+ } ) ;
262+ $ ( "<div />" , {
263+ "id" : "tooltip-content"
264+ } ) . appendTo ( $ ( "div#lab" ) ) ;
265+ $ ( "<a/>" , {
266+ "id" : "nested-tooltip" ,
267+ "href" : "#nested-tooltip-content" ,
268+ "title" : "nested tooltip title attribute" ,
269+ "data-pat-tooltip" : "trigger: click; source: content" ,
270+ "class" : "pat-tooltip"
271+ } ) . appendTo ( $ ( "div#tooltip-content" ) ) ;
272+ } ) ;
273+ afterEach ( function ( ) {
274+ utils . removeTooltip ( ) ;
275+ } ) ;
276+ it ( "will not close if the contained trigger is clicked" , function ( ) {
277+ runs ( function ( ) {
278+ spyOn ( pattern , "show" ) . andCallThrough ( ) ;
279+ var $el = $ ( "a#tooltip" ) ;
280+ pattern . init ( $el ) ;
281+ pattern . init ( $ ( "a#nested-tooltip" ) ) ;
282+ $el . trigger ( utils . click ) ;
283+ expect ( pattern . show ) . toHaveBeenCalled ( ) ;
284+ } ) ;
285+ waits ( 100 ) ; // hide events get registered 50 ms after show
286+ runs ( function ( ) {
287+ $ ( ".tooltip-container a#nested-tooltip" ) . trigger ( utils . click ) ;
288+ expect ( $ ( ".tooltip-container a#nested-tooltip" ) . css ( "visibility" ) ) . toBe ( "visible" ) ;
289+ } ) ;
290+ } ) ;
291+ } ) ;
255292 } ) ;
256293} ) ;
257294// jshint indent: 4, browser: true, jquery: true, quotmark: double
0 commit comments