readonly.spec.ts (vue-2.7.13) | : | readonly.spec.ts (vue-2.7.14) | ||
---|---|---|---|---|
skipping to change at line 529 | skipping to change at line 529 | |||
const foo = new Foo() | const foo = new Foo() | |||
const readonlyFoo = readonly(foo) | const readonlyFoo = readonly(foo) | |||
readonlyFoo.log() | readonlyFoo.log() | |||
expect(spy).toHaveBeenCalledWith(1) | expect(spy).toHaveBeenCalledWith(1) | |||
readonlyFoo.change() | readonlyFoo.change() | |||
expect(readonlyFoo.x).toBe(1) | expect(readonlyFoo.x).toBe(1) | |||
expect(`et operation on key "x" failed`).toHaveBeenWarned() | expect(`et operation on key "x" failed`).toHaveBeenWarned() | |||
}) | }) | |||
test('compatibility with non-extensible objects', () => { | test('warn non-extensible objects', () => { | |||
const foo = Object.freeze({ a: 1 }) | const foo = Object.freeze({ a: 1 }) | |||
const bar = readonly(foo) | try { | |||
expect(isReadonly(bar)).toBe(true) | readonly(foo) | |||
expect(readonly(foo)).toBe(bar) | } catch (e) {} | |||
expect( | ||||
`Vue 2 does not support creating readonly proxy for non-extensible object` | ||||
).toHaveBeenWarned() | ||||
}) | }) | |||
}) | }) | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 7 lines changed or added |