jQuery UI Tooltip打开更改内容

时间:2013-04-18 05:42:00

标签: unit-testing jquery-ui-tooltip

我在ui.tooltip中发现了一个错误:如果内容发生变化,工具提示会中断关闭。这是example

请帮我做一个正确的测试,这个不时失败“工具提示太早隐藏”:

asyncTest( "content: change while close", function() {
    expect( 2 );
    $.fx.off = true
    var tooltip,
        hidingDuration = 20,
        element = $( "#tooltipped1" ).tooltip({
            hide: hidingDuration
        });

    element.tooltip( "open" );
    tooltip = $( "#" + element.data( "ui-tooltip-id" ) );

    $.fx.off = false;
    element.tooltip( "close" );
    setTimeout( function() {
        ok( tooltip.is( ":visible" ), "tooltip was hidden too early" );
    }, hidingDuration * 0.5 );

    //element.tooltip({ content: 'Foo' });
    //tooltip = $( "#" + element.data( "ui-tooltip-id" ) );

    setTimeout( function() {
        ok( !tooltip.is( ":visible" ), "tooltip doesn't hid properly" );
        start();
    }, hidingDuration * 1.5 );
});

0 个答案:

没有答案