mediawiki-extensions-Visual.../tests/es.test.js
2011-11-02 21:21:02 +00:00

15 lines
379 B
JavaScript

module( 'es' );
test( 'es.insertIntoArray', 1, function() {
var insert = [], i, arr = ['foo', 'bar'], expected = [];
expected[0] = 'foo';
for ( i = 0; i < 3000; i++ ) {
insert[i] = i;
expected[i + 1] = i;
}
expected[3001] = 'bar';
es.insertIntoArray( arr, 1, insert );
deepEqual( arr, expected, 'splicing 3000 elements into the middle of a 2-element array' );
} );