jQuery: The Write Less, Do More JavaScript Library

Changeset 5504

Show
Ignore:
Timestamp:
05/08/08 17:11:03 (5 days ago)
Author:
aflesler
Message:

test runner: extra tests for $.fn.add enabled by [5503] and a small fix for an html() test.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/test/unit/core.js

    r5498 r5504  
    262262 
    263263test("add(String|Element|Array|undefined)", function() { 
    264     expect(8); 
     264    expect(12); 
    265265    isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" ); 
    266266    isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" ); 
     
    281281    var notDefined; 
    282282    equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing" ); 
     283     
     284    // Added after #2811 
     285    equals( $([]).add([window,document,document.body,document]).length, 3, "Pass an array" ); 
     286    equals( $(document).add(document).length, 1, "Check duplicated elements" ); 
     287    equals( $(window).add(window).length, 1, "Check duplicated elements using the window" ); 
     288    ok( $([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" ); 
    283289}); 
    284290 
     
    11491155    var j = $("#nonnodes").contents(); 
    11501156    j.html("<b>bold</b>"); 
     1157     
     1158    // this is needed, or the expando added by jQuery unique will yield a different html 
     1159    j.find('b').removeData();    
    11511160    equals( j.html().toLowerCase(), "<b>bold</b>", "Check node,textnode,comment with html()" ); 
    11521161