|
|
@@ -46,28 +46,22 @@ describe('Options extends', () => {
|
|
|
expect(vm.b).toBe(2)
|
|
|
expect(vm.c).toBe(3)
|
|
|
})
|
|
|
-})
|
|
|
|
|
|
-describe('Options extends with Object.prototype.watch', () => {
|
|
|
- beforeAll(function () {
|
|
|
+ it('should work with global mixins + Object.prototype.watch', done => {
|
|
|
+ let fakeWatch = false
|
|
|
if (!Object.prototype.watch) {
|
|
|
+ fakeWatch = true
|
|
|
// eslint-disable-next-line no-extend-native
|
|
|
- Object.prototype.watch = {
|
|
|
- remove: true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- afterAll(function () {
|
|
|
- if (Object.prototype.watch && Object.prototype.watch.remove) {
|
|
|
- delete Object.prototype.watch
|
|
|
+ Object.defineProperty(Object.prototype, 'watch', {
|
|
|
+ writable: true,
|
|
|
+ configurable: true,
|
|
|
+ enumerable: false,
|
|
|
+ value: () => {}
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- it('should work with global mixins', done => {
|
|
|
- Vue.use({
|
|
|
- install: function () {
|
|
|
- Vue.mixin({})
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ Vue.mixin({})
|
|
|
+
|
|
|
const spy = jasmine.createSpy('watch')
|
|
|
const A = Vue.extend({
|
|
|
data: function () {
|
|
|
@@ -85,6 +79,10 @@ describe('Options extends with Object.prototype.watch', () => {
|
|
|
})
|
|
|
waitForUpdate(() => {
|
|
|
expect(spy).toHaveBeenCalledWith(2, 1)
|
|
|
+
|
|
|
+ if (fakeWatch) {
|
|
|
+ delete Object.prototype.watch
|
|
|
+ }
|
|
|
}).then(done)
|
|
|
})
|
|
|
})
|