File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/reactivity/__tests__ Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,20 @@ describe('reactivity/reactive', () => {
26
26
expect ( Object . keys ( observed ) ) . toEqual ( [ 'foo' ] )
27
27
} )
28
28
29
+ test ( 'proto' , ( ) => {
30
+ const obj = { }
31
+ const reactiveObj = reactive ( obj )
32
+ expect ( isReactive ( reactiveObj ) ) . toBe ( true )
33
+ // read prop of reactiveObject will cause reactiveObj[prop] to be reactive
34
+ // @ts -ignore
35
+ const prototype = reactiveObj [ '__proto__' ]
36
+ const otherObj = { data : [ 'a' ] }
37
+ expect ( isReactive ( otherObj ) ) . toBe ( false )
38
+ const reactiveOther = reactive ( otherObj )
39
+ expect ( isReactive ( reactiveOther ) ) . toBe ( true )
40
+ expect ( reactiveOther . data [ 0 ] ) . toBe ( 'a' )
41
+ } )
42
+
29
43
test ( 'nested reactives' , ( ) => {
30
44
const original = {
31
45
nested : {
You can’t perform that action at this time.
0 commit comments