aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMorgan Harris <gormster@me.com>2021-11-24 11:47:42 +1100
committerMorgan Harris <gormster@me.com>2021-11-24 11:47:42 +1100
commitbb8b54a3bbe415f1ca6c9fbe917604adb16b53ad (patch)
tree4ec1185ad535b062254dd9d344f022ccb1b106c7 /spec
parente45843c71c73511ba0f499053184883ddc28f990 (diff)
downloadsvg.js-bb8b54a3bbe415f1ca6c9fbe917604adb16b53ad.tar.gz
svg.js-bb8b54a3bbe415f1ca6c9fbe917604adb16b53ad.zip
Add a test to check that the new and original methods both work
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/types/List.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/spec/types/List.js b/spec/spec/types/List.js
index 9fd27db..21f9cb2 100644
--- a/spec/spec/types/List.js
+++ b/spec/spec/types/List.js
@@ -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;
});