@@ -46,39 +46,44 @@ if (_.inBrowser) {
46
46
a : 'A'
47
47
}
48
48
} ,
49
- template : '<test testt="{{@test}}" bb="{{@b}}" v-ref="child"></test>' ,
49
+ template : '<test testt="{{@test}}" bb="{{@b}}" a="{{@ test.a }}" v-ref="child"></test>' ,
50
50
components : {
51
51
test : {
52
- props : [ 'testt' , 'bb' ] ,
53
- template : '{{testt.a}} {{bb}}'
52
+ props : [ 'testt' , 'bb' , 'a' ] ,
53
+ template : '{{testt.a}} {{bb}} {{a}} '
54
54
}
55
55
}
56
56
} )
57
- expect ( el . firstChild . textContent ) . toBe ( 'A B' )
57
+ expect ( el . firstChild . textContent ) . toBe ( 'A B A ' )
58
58
vm . test . a = 'AA'
59
59
vm . b = 'BB'
60
60
_ . nextTick ( function ( ) {
61
- expect ( el . firstChild . textContent ) . toBe ( 'AA BB' )
61
+ expect ( el . firstChild . textContent ) . toBe ( 'AA BB AA ' )
62
62
vm . test = { a : 'AAA' }
63
63
_ . nextTick ( function ( ) {
64
- expect ( el . firstChild . textContent ) . toBe ( 'AAA BB' )
64
+ expect ( el . firstChild . textContent ) . toBe ( 'AAA BB AAA ' )
65
65
vm . $data = {
66
66
b : 'BBB' ,
67
67
test : {
68
68
a : 'AAAA'
69
69
}
70
70
}
71
71
_ . nextTick ( function ( ) {
72
- expect ( el . firstChild . textContent ) . toBe ( 'AAAA BBB' )
72
+ expect ( el . firstChild . textContent ) . toBe ( 'AAAA BBB AAAA ' )
73
73
// test two-way
74
74
vm . $ . child . bb = 'B'
75
75
vm . $ . child . testt = { a : 'A' }
76
76
_ . nextTick ( function ( ) {
77
- expect ( el . firstChild . textContent ) . toBe ( 'A B' )
77
+ expect ( el . firstChild . textContent ) . toBe ( 'A B A ' )
78
78
expect ( vm . test . a ) . toBe ( 'A' )
79
79
expect ( vm . test ) . toBe ( vm . $ . child . testt )
80
80
expect ( vm . b ) . toBe ( 'B' )
81
- done ( )
81
+ vm . $ . child . a = 'Oops'
82
+ _ . nextTick ( function ( ) {
83
+ expect ( el . firstChild . textContent ) . toBe ( 'Oops B Oops' )
84
+ expect ( vm . test . a ) . toBe ( 'Oops' )
85
+ done ( )
86
+ } )
82
87
} )
83
88
} )
84
89
} )
<
34D4
svg aria-hidden="true" focusable="false" class="octicon octicon-fold-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom">
0 commit comments