File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,15 @@ import { isRef, UnwrapRef } from './ref'
15
15
import { rawSet , accessModifiedSet } from '../utils/sets'
16
16
17
17
export function isRaw ( obj : any ) : boolean {
18
- return Boolean ( obj ?. __ob__ && obj . __ob__ ?. __raw__ )
18
+ return Boolean (
19
+ obj ?. __ob__ && typeof obj . __ob__ === 'object' && obj . __ob__ ?. __raw__
20
+ )
19
21
}
20
22
21
23
export function isReactive ( obj : any ) : boolean {
22
- return Boolean ( obj ?. __ob__ && ! obj . __ob__ ?. __raw__ )
24
+ return Boolean (
25
+ obj ?. __ob__ && typeof obj . __ob__ === 'object' && ! obj . __ob__ ?. __raw__
26
+ )
23
27
}
24
28
25
29
/**
Original file line number Diff line number Diff line change @@ -1169,4 +1169,28 @@ describe('setup', () => {
1169
1169
1170
1170
expect ( warn ) . not . toBeCalled ( )
1171
1171
} )
1172
+
1173
+ it ( 'should work with mock objects' , async ( ) => {
1174
+ const originalProxy = new Proxy (
1175
+ { } ,
1176
+ {
1177
+ get ( ) {
1178
+ return jest . fn ( )
1179
+ } ,
1180
+ }
1181
+ )
1182
+
1183
+ const opts = {
1184
+ template : `<div/>` ,
1185
+ setup ( ) {
1186
+ return {
1187
+ proxy : originalProxy ,
1188
+ }
1189
+ } ,
1190
+ }
1191
+ const Constructor = Vue . extend ( opts ) . extend ( { } )
1192
+
1193
+ const vm = new Vue ( Constructor ) . $mount ( )
1194
+ expect ( vm . proxy ) . toBe ( originalProxy )
1195
+ } )
1172
1196
} )
You can’t perform that action at this time.
0 commit comments