Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Array#splice when only the first argument is provided. #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/spec/s-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,21 @@ describe('Array', function () {
expect(test).toEqual(test2);
});

it('should work without optional arguments 1', function () {
var array = [0, 1, 2];
expect(array.splice(0)).toEqual([]);
});

it('should work without optional arguments 2', function () {
var array = [0, 1, 2];
expect(array.splice(1)).toEqual([0]);
});

it('should work without optional arguments 3', function () {
var array = [0, 1, 2];
expect(array.splice(2)).toEqual([0, 1]);
});

it('should work with objects - adding 1', function () {
var obj = {};
Array.prototype.splice.call(obj, 0, 0, 1, 2, 3);
Expand Down