]> source.dussan.org Git - svg.js.git/commitdiff
Add a test to check that the new and original methods both work 1238/head
authorMorgan Harris <gormster@me.com>
Wed, 24 Nov 2021 00:47:42 +0000 (11:47 +1100)
committerMorgan Harris <gormster@me.com>
Wed, 24 Nov 2021 00:47:42 +0000 (11:47 +1100)
spec/spec/types/List.js

index 9fd27db38a361f2d15487d6bc66d3fcba1ef00f7..21f9cb26425b80bb1b84522b3e2f05111e55bdbe 100644 (file)
@@ -82,6 +82,21 @@ describe('List.js', () => {
       List.extend([ 'unshift' ])
       expect(new List().unshift).toEqual(any(Function))
       expect(new List().$unshift).toEqual(Array.prototype.unshift)
+
+      // Check that it works!
+      const sourceArray = [
+        { 'unshift': () => 1 },
+        { 'unshift': () => 2 },
+        { 'unshift': () => 3 }
+      ];
+      const list = new List(sourceArray)
+
+      expect(list).toEqual(sourceArray)
+      expect(list.unshift(0)).toEqual([1,2,3])
+
+      expect(list.$unshift(0)).toEqual(4)
+      expect(list).toEqual([0].concat(sourceArray))
+
       delete List.prototype.unshift;
     });