0

阅读 jQuery 1.8 test/unit/effects.js测试,这里要测试什么?

    var speeds = {
        'null speed' : null,
        'undefined speed': undefined,
        'false speed': false
    }

    // make sure passing bogus arguments doesn't change state var ?
    jQuery.each( speeds,
                 function( name, speed ) {
                     pass = true;
                     div.hide()
                         .show(speed)
                         .each( function() {
                                     if( this.style.display == 'none' ) {
                                         pass = false;
                                     }
                              });
                         ok( pass, 'Show with ' + name );
                 });
4

1 回答 1

0

正如代码中的注释所述,它确保将无效值传递给.show()方法不会破坏它。即.show( null ),.show( undefined ).show( false )all 显示元素,即使参数无效。

于 2012-07-24T17:40:47.270 回答