|
|
@@ -47,3 +47,44 @@ describe('Options extends', () => {
|
|
|
expect(vm.c).toBe(3)
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+describe('Options extends with Object.prototype.watch', () => {
|
|
|
+ beforeAll(function () {
|
|
|
+ if (!Object.prototype.watch) {
|
|
|
+ // 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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ it('should work with global mixins', done => {
|
|
|
+ Vue.use({
|
|
|
+ install: function () {
|
|
|
+ Vue.mixin({})
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const spy = jasmine.createSpy('watch')
|
|
|
+ const A = Vue.extend({
|
|
|
+ data: function () {
|
|
|
+ return { a: 1 }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ a: spy
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+ this.a = 2
|
|
|
+ }
|
|
|
+ })
|
|
|
+ new Vue({
|
|
|
+ extends: A
|
|
|
+ })
|
|
|
+ waitForUpdate(() => {
|
|
|
+ expect(spy).toHaveBeenCalledWith(2, 1)
|
|
|
+ }).then(done)
|
|
|
+ })
|
|
|
+})
|