瀏覽代碼

Add a test to check that the new and original methods both work

tags/3.2.1
Morgan Harris 2 年之前
父節點
當前提交
bb8b54a3bb
共有 1 個檔案被更改,包括 15 行新增0 行删除
  1. 15
    0
      spec/spec/types/List.js

+ 15
- 0
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;
});


Loading…
取消
儲存