Tooltip: Unit test for nested tooltips

This commit is contained in:
Jörn Zaefferer 2012-10-21 13:25:36 -04:00
parent 132e9f0c72
commit 78f781fccd
2 changed files with 17 additions and 1 deletions

View File

@ -43,7 +43,7 @@
<input title="inputtitle"> <input title="inputtitle">
<span id="multiple-describedby" aria-describedby="fixture-span" title="...">aria-describedby</span> <span id="multiple-describedby" aria-describedby="fixture-span" title="...">aria-describedby</span>
<span id="fixture-span" title="title-text">span</span> <span id="fixture-span" title="title-text">span</span>
<span id="contains-tooltipped"><span id="contained-tooltipped" title="foobar">baz</span></span> <span id="contains-tooltipped" title="parent"><span id="contained-tooltipped" title="child">baz</span></span>
</div> </div>
</div> </div>

View File

@ -57,4 +57,20 @@ test( "delegated removal", function() {
equal( $( ".ui-tooltip" ).length, 0 ); equal( $( ".ui-tooltip" ).length, 0 );
}); });
test( "nested tooltips", function() {
expect( 2 );
var child = $( "#contained-tooltipped" ),
parent = $( "#contains-tooltipped" ).tooltip({
show: null,
hide: null
});
parent.trigger( "mouseover" );
equal( $( ".ui-tooltip:visible" ).text(), "parent" );
child.trigger( "mouseover" );
equal( $( ".ui-tooltip" ).text(), "child" );
});
}( jQuery ) ); }( jQuery ) );