1
1
var Observer = require ( '../../../../src/observer' )
2
2
var Dep = require ( '../../../../src/observer/dep' )
3
3
var _ = require ( '../../../../src/util' )
4
+ var config = require ( '../../../../src/config' )
4
5
5
6
describe ( 'Observer' , function ( ) {
6
7
@@ -39,6 +40,9 @@ describe('Observer', function () {
39
40
} )
40
41
41
42
it ( 'create on already observed object' , function ( ) {
43
+ var previousConvertAllProperties = config . convertAllProperties
44
+ config . convertAllProperties = true
45
+
42
46
// on object
43
47
var obj = { }
44
48
var val = 0
@@ -65,6 +69,8 @@ describe('Observer', function () {
65
69
// should call underlying setter
66
70
obj . a = 10
67
71
expect ( val ) . toBe ( 10 )
72
+
73
+ config . convertAllProperties = previousConvertAllProperties
68
74
} )
69
75
70
76
it ( 'create on array' , function ( ) {
@@ -112,6 +118,9 @@ describe('Observer', function () {
112
118
} )
113
119
114
120
it ( 'observing object prop change on defined property' , function ( ) {
121
+ var previousConvertAllProperties = config . convertAllProperties
122
+ config . convertAllProperties = true
123
+
115
124
var obj = { val : 2 }
116
125
Object . defineProperty ( obj , 'a' , {
117
126
configurable : true ,
@@ -143,6 +152,8 @@ describe('Observer', function () {
143
152
expect ( obj . val ) . toBe ( 3 ) // make sure 'setter' was called
144
153
obj . val = 5
145
154
expect ( obj . a ) . toBe ( 5 ) // make sure 'getter' was called
155
+
156
+ config . convertAllProperties = previousConvertAllProperties
146
157
} )
147
158
148
159
it ( 'observing set/delete' , function ( ) {
0 commit comments