Bug Tracker

Ticket #1747: unique.patch

File unique.patch, 3.6 KB (added by rworth, 5 years ago)
  • src/core.js

    Property changes on: src\ajax.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
     
    10931093                try { 
    10941094 
    10951095                        for ( var i = 0, length = array.length; i < length; i++ ) { 
    1096                                 var id = jQuery.data( array[ i ] ); 
     1096                                var id = array[ i ]; 
    10971097 
     1098                                if ("object" == typeof array[ i ]) 
     1099                                        id = jQuery.data( array[ i ] ); 
     1100 
    10981101                                if ( !done[ id ] ) { 
    10991102                                        done[ id ] = true; 
    11001103                                        ret.push( array[ i ] ); 
  • test/unit/core.js

    Property changes on: src\core.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\event.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\fx.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\intro.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\offset.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\outro.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: src\selector.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
    
    Property changes on: test\unit\ajax.js
    ___________________________________________________________________
    Name: svn:eol-style
       + native
    
     
    10741074        // Disabled, randomly fails 
    10751075        //ok( $("#iframe").contents()[0].body, "Check existance of IFrame body" ); 
    10761076}); 
     1077 
     1078test("$.unique(array)", function() { 
     1079        expect(9); 
     1080        isSet( $.unique([]), [], "Check .unique() with empty array" ); 
     1081        isSet( $.unique([1, 2, 3]), [1, 2, 3], "Check with array of ints, no duplicates." ); 
     1082        isSet( $.unique([1, 1, 2, 2, 3, 3]), [1, 2, 3], "Check with array of ints, duplicates." ); 
     1083        isSet( $.unique(['a', 'b', 'c']), ['a', 'b', 'c'], "Check with array of strings, no duplicates." ); 
     1084        isSet( $.unique(['a', 'a', 'b', 'b', 'c', 'c']), ['a', 'b', 'c'], "Check with array of strings, duplicates." ); 
     1085        var arr1 = [1, 2], arr2 = ['a', 'b']; 
     1086        isSet( $.unique([arr1, arr2]), [arr1, arr2], "Check with array of arrays, no duplicates." ); 
     1087        isSet( $.unique([arr1, arr2, arr1, arr2]), [arr1, arr2], "Check with array of arrays, duplicates." ); 
     1088        var obj1 = {"":"obj1"}, obj2 = {"":"obj2"}; 
     1089        isSet( $.unique([obj1, obj2]), [obj1, obj2], "Check with array of objects, no duplicates." ); 
     1090        isSet( $.unique([obj1, obj2, obj1, obj2]), [obj1, obj2], "Check with array of objects, duplicates." ); 
     1091});