Skip to content

Commit

Permalink
Merge pull request #71 from asudoh/WidgetList
Browse files Browse the repository at this point in the history
Support varargs in concat() in StatefulArray, fixes #16629.
  • Loading branch information
edchat committed Jan 29, 2013
2 parents 14194d3 + 138721b commit 4216403
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion StatefulArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ define([
return this.get("length");
},
concat: function(/*Array*/ a){
return new StatefulArray([].concat(this).concat(a));
return new StatefulArray([].concat.apply(this, arguments));
},
join: function(/*String*/ sep){
// summary:
Expand Down
6 changes: 6 additions & 0 deletions tests/doh/StatefulArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ define([
var a = new StatefulArray([0, 1, 2, 3]);
doh.is([1, 2], a.slice(-3, 3), "Index 1 and index 2 should be returned");
doh.is([1], a.slice(-3, -2), "Index 1 should be returned");
},
function concat(){
var a = new StatefulArray([0, 1, 2, 3]);
doh.is([0, 1, 2, 3], a.concat(), "concat() with empty args should end up with the same array");
doh.is([0, 1, 2, 3, 4, 5, 6, 7, 8], a.concat([4, 5], [6, 7, 8]), "concat() should support multiple args");
doh.is([0, 1, 2, 3, 4, 5, 6, 7, 8], a.concat(4, 5, [6, 7, 8]), "concat() should non-array values");
}
]);
});

0 comments on commit 4216403

Please sign in to comment.