From a916f6e1ace4cb1277e37e7b2ccb07940a0bfe3f Mon Sep 17 00:00:00 2001 From: Xotic750 Date: Thu, 28 Jan 2016 17:24:40 +0100 Subject: [PATCH] Add tests for Array#splice when only the first argument is provided. https://github.com/es-shims/es5-shim/issues/341 --- tests/spec/s-array.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/spec/s-array.js b/tests/spec/s-array.js index 734f7aa1..e0a79d03 100644 --- a/tests/spec/s-array.js +++ b/tests/spec/s-array.js @@ -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);