@@ -251,7 +251,7 @@ describe('Vuex', () => {
251
251
const store = new Vuex . Store ( {
252
252
modules : {
253
253
a : {
254
- namespace : 'prefix/'
254
+ namespaced : true
255
255
}
256
256
}
257
257
} )
@@ -265,12 +265,12 @@ describe('Vuex', () => {
265
265
} )
266
266
267
267
expect ( store . state . a . b . value ) . toBe ( 1 )
268
- expect ( store . getters [ 'prefix /foo' ] ) . toBe ( 1 )
268
+ expect ( store . getters [ 'a /foo' ] ) . toBe ( 1 )
269
269
270
- store . dispatch ( 'prefix /foo' )
270
+ store . dispatch ( 'a /foo' )
271
271
expect ( actionSpy ) . toHaveBeenCalled ( )
272
272
273
- store . commit ( 'prefix /foo' )
273
+ store . commit ( 'a /foo' )
274
274
expect ( mutationSpy ) . toHaveBeenCalled ( )
275
275
} )
276
276
@@ -614,7 +614,7 @@ describe('Vuex', () => {
614
614
const store = new Vuex . Store ( {
615
615
modules : {
616
616
a : {
617
- namespace : 'prefix/' ,
617
+ namespaced : true ,
618
618
state : {
619
619
a : 1
620
620
} ,
@@ -632,26 +632,26 @@ describe('Vuex', () => {
632
632
} )
633
633
634
634
expect ( store . state . a . a ) . toBe ( 1 )
635
- expect ( store . getters [ 'prefix /b' ] ) . toBe ( 2 )
636
- store . dispatch ( 'prefix /' + TEST )
635
+ expect ( store . getters [ 'a /b' ] ) . toBe ( 2 )
636
+ store . dispatch ( 'a /' + TEST )
637
637
expect ( actionSpy ) . toHaveBeenCalled ( )
638
- store . commit ( 'prefix /' + TEST )
638
+ store . commit ( 'a /' + TEST )
639
639
expect ( mutationSpy ) . toHaveBeenCalled ( )
640
640
} )
641
641
642
642
it ( 'module: nested namespace' , ( ) => {
643
643
// mock module generator
644
644
const actionSpys = [ ]
645
645
const mutationSpys = [ ]
646
- const createModule = ( name , namespace , children ) => {
646
+ const createModule = ( name , namespaced , children ) => {
647
647
const actionSpy = jasmine . createSpy ( )
648
648
const mutationSpy = jasmine . createSpy ( )
649
649
650
650
actionSpys . push ( actionSpy )
651
651
mutationSpys . push ( mutationSpy )
652
652
653
653
return {
654
- namespace ,
654
+ namespaced ,
655
655
state : {
656
656
[ name ] : true
657
657
} ,
@@ -670,11 +670,11 @@ describe('Vuex', () => {
670
670
671
671
// mock module
672
672
const modules = {
673
- a : createModule ( 'a' , 'a/' , { // a/a
674
- b : createModule ( 'b' , null , { // a/b - does not add namespace
675
- c : createModule ( 'c' , 'c/' ) // a/c/c
673
+ a : createModule ( 'a' , true , { // a/a
674
+ b : createModule ( 'b' , false , { // a/b - does not add namespace
675
+ c : createModule ( 'c' , true ) // a/c/c
676
676
} ) ,
677
- d : createModule ( 'd' , 'd/' ) , // a/d/d
677
+ d : createModule ( 'd' , true ) , // a/d/d
678
678
} )
679
679
}
680
680
@@ -714,7 +714,7 @@ describe('Vuex', () => {
714
714
} ,
715
715
modules : {
716
716
a : {
717
- namespace : 'prefix/' ,
717
+ namespaced : true ,
718
718
state : { value : 'module' } ,
719
719
getters : {
720
720
foo : state => state . value ,
@@ -725,9 +725,9 @@ describe('Vuex', () => {
725
725
}
726
726
} )
727
727
728
- expect ( store . getters [ 'prefix /foo' ] ) . toBe ( 'module' )
729
- expect ( store . getters [ 'prefix /bar' ] ) . toBe ( 'module' )
730
- expect ( store . getters [ 'prefix /baz' ] ) . toBe ( 'root' )
728
+ expect ( store . getters [ 'a /foo' ] ) . toBe ( 'module' )
729
+ expect ( store . getters [ 'a /bar' ] ) . toBe ( 'module' )
730
+ expect ( store . getters [ 'a /baz' ] ) . toBe ( 'root' )
731
731
} )
732
732
733
733
it ( 'module: action context is namespaced in namespaced module' , done => {
@@ -743,7 +743,7 @@ describe('Vuex', () => {
743
743
mutations : { foo : rootMutationSpy } ,
744
744
modules : {
745
745
a : {
746
- namespace : 'prefix/' ,
746
+ namespaced : true ,
747
747
state : { value : 'module' } ,
748
748
getters : { foo : state => state . value } ,
749
749
actions : {
@@ -770,7 +770,7 @@ describe('Vuex', () => {
770
770
}
771
771
} )
772
772
773
- store . dispatch ( 'prefix /test' )
773
+ store . dispatch ( 'a /test' )
774
774
} )
775
775
776
776
it ( 'module: use other module that has same namespace' , done => {
@@ -780,7 +780,7 @@ describe('Vuex', () => {
780
780
const store = new Vuex . Store ( {
781
781
modules : {
782
782
parent : {
783
- namespace : 'prefix/' ,
783
+ namespaced : true ,
784
784
785
785
modules : {
786
786
a : {
@@ -813,7 +813,7 @@ describe('Vuex', () => {
813
813
}
814
814
} )
815
815
816
- store . dispatch ( 'prefix /test' )
816
+ store . dispatch ( 'parent /test' )
817
817
} )
818
818
819
819
it ( 'dispatching multiple actions in different modules' , done => {
@@ -1210,7 +1210,7 @@ describe('Vuex', () => {
1210
1210
const store = new Vuex . Store ( {
1211
1211
modules : {
1212
1212
a : {
1213
- namespace : 'prefix/' ,
1213
+ namespaced : true ,
1214
1214
state : { value : 1 } ,
1215
1215
getters : { foo : state => state . value } ,
1216
1216
actions : { foo : actionSpy } ,
@@ -1220,38 +1220,38 @@ describe('Vuex', () => {
1220
1220
} )
1221
1221
1222
1222
expect ( store . state . a . value ) . toBe ( 1 )
1223
- expect ( store . getters [ 'prefix /foo' ] ) . toBe ( 1 )
1224
- store . dispatch ( 'prefix /foo' )
1223
+ expect ( store . getters [ 'a /foo' ] ) . toBe ( 1 )
1224
+ store . dispatch ( 'a /foo' )
1225
1225
expect ( actionSpy . calls . count ( ) ) . toBe ( 1 )
1226
- store . commit ( 'prefix /foo' )
1226
+ store . commit ( 'a /foo' )
1227
1227
expect ( actionSpy . calls . count ( ) ) . toBe ( 1 )
1228
1228
1229
1229
store . hotUpdate ( {
1230
1230
modules : {
1231
1231
a : {
1232
- namespace : 'prefix-changed/'
1232
+ namespaced : false
1233
1233
}
1234
1234
}
1235
1235
} )
1236
1236
1237
1237
expect ( store . state . a . value ) . toBe ( 1 )
1238
- expect ( store . getters [ 'prefix /foo' ] ) . toBe ( undefined ) // removed
1239
- expect ( store . getters [ 'prefix-changed/ foo' ] ) . toBe ( 1 ) // renamed
1238
+ expect ( store . getters [ 'a /foo' ] ) . toBe ( undefined ) // removed
1239
+ expect ( store . getters [ 'foo' ] ) . toBe ( 1 ) // renamed
1240
1240
1241
1241
// should not be called
1242
- store . dispatch ( 'prefix /foo' )
1242
+ store . dispatch ( 'a /foo' )
1243
1243
expect ( actionSpy . calls . count ( ) ) . toBe ( 1 )
1244
1244
1245
1245
// should be called
1246
- store . dispatch ( 'prefix-changed/ foo' )
1246
+ store . dispatch ( 'foo' )
1247
1247
expect ( actionSpy . calls . count ( ) ) . toBe ( 2 )
1248
1248
1249
1249
// should not be called
1250
- store . commit ( 'prefix /foo' )
1250
+ store . commit ( 'a /foo' )
1251
1251
expect ( mutationSpy . calls . count ( ) ) . toBe ( 1 )
1252
1252
1253
1253
// should be called
1254
- store . commit ( 'prefix-changed/ foo' )
1254
+ store . commit ( 'foo' )
1255
1255
expect ( mutationSpy . calls . count ( ) ) . toBe ( 2 )
1256
1256
} )
1257
1257
0 commit comments