mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-14 01:57:02 +00:00
15 lines
379 B
JavaScript
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' );
|
||
|
} );
|