@@ -1169,13 +1169,36 @@ describe('Service Module - Mutations', function () {
1169
1169
1170
1170
const item1 = {
1171
1171
_id : 1 ,
1172
- test : true /*,
1172
+ test : true
1173
+ }
1174
+ store . commit ( 'comics/addItem' , item1 )
1175
+
1176
+ // Create a copy and modify it.
1177
+ store . commit ( 'comics/createCopy' , item1 . _id )
1178
+ const copy = Comic . copiesById [ item1 . _id ]
1179
+ copy . test = false
1180
+
1181
+ // Call resetCopy and check that it's back to the original value
1182
+ store . commit ( 'comics/resetCopy' , item1 . _id )
1183
+
1184
+ assert ( copy . test === true , 'the copy was reset' )
1185
+
1186
+ clearModels ( )
1187
+ } )
1188
+
1189
+ it . skip ( 'resetCopy with keepCopiesInStore: false and with intact getter/setter' , function ( ) {
1190
+ const context = makeContext ( )
1191
+ const { Comic, store } = context
1192
+
1193
+ const item1 = {
1194
+ _id : 1 ,
1195
+ test : true ,
1173
1196
get getter ( ) {
1174
1197
return 'Life is a Joy!'
1175
1198
} ,
1176
1199
set setter ( val ) {
1177
1200
this . test = val
1178
- }*/
1201
+ }
1179
1202
}
1180
1203
store . commit ( 'comics/addItem' , item1 )
1181
1204
@@ -1190,9 +1213,9 @@ describe('Service Module - Mutations', function () {
1190
1213
assert ( copy . test === true , 'the copy was reset' )
1191
1214
1192
1215
// Make sure accessors stayed intact
1193
- // assertGetter(copy, 'getter', 'Life is a Joy!')
1194
- // copy.setter = false
1195
- // assert(copy.test === false, 'the setter is intact')
1216
+ assertGetter ( copy , 'getter' , 'Life is a Joy!' )
1217
+ copy . setter = false
1218
+ assert ( copy . test === false , 'the setter is intact' )
1196
1219
1197
1220
clearModels ( )
1198
1221
} )
0 commit comments