File tree Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Expand file tree Collapse file tree 3 files changed +31
-16
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,9 @@ const mutations = {
201
201
} ,
202
202
[ types . ADD_TO_COMPONENT_ACTIONS ] : ( state , payload ) => {
203
203
state . componentMap [ state . activeComponent ] . componentActions . push ( payload )
204
+ } ,
205
+ [ types . ADD_TO_COMPONENT_STATE ] : ( state , payload ) => {
206
+ state . componentMap [ state . activeComponent ] . componentState . push ( payload )
204
207
}
205
208
}
206
209
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export const PARENT_SELECTED = 'PARENT_SELECTED'
42
42
export const DELETE_ROUTE = 'DELETE_ROUTE'
43
43
export const DELETE_COMPONENT = 'DELETE_COMPONENT'
44
44
export const ADD_TO_COMPONENT_ACTIONS = 'ADD_TO_COMPONENT_ACTIONS'
45
+ export const ADD_TO_COMPONENT_STATE = 'ADD_TO_COMPONENT_STATE'
45
46
46
47
// Actions
47
48
export const registerComponent = 'registerComponent'
Original file line number Diff line number Diff line change @@ -27,22 +27,33 @@ describe('Dummy test', () => {
27
27
} )
28
28
} )
29
29
30
- describe ( 'Adding actions to components' , ( ) => {
31
- const state = {
32
- componentMap : {
33
- testComponent : {
34
- componentName : 'testComponent' ,
35
- children : [ ] ,
36
- htmlList : [ ] ,
37
- componentActions : [ ] ,
38
- componentState : [ ]
39
- }
40
- } ,
41
- activeComponent : 'testComponent'
42
- }
43
- it ( 'should add a single action to a component based on active component' , ( ) => {
44
- mutations . ADD_TO_COMPONENT_ACTIONS ( state , 'testAction' )
45
- expect ( state . componentMap [ state . activeComponent ] . componentActions ) . toEqual ( [ 'testAction' ] )
30
+ describe ( 'Adding actions and state to components' , ( ) => {
31
+ let state ;
32
+ beforeEach ( ( ) => {
33
+ state = {
34
+ componentMap : {
35
+ testComponent : {
36
+ componentName : 'testComponent' ,
37
+ children : [ ] ,
38
+ htmlList : [ ] ,
39
+ componentActions : [ ] ,
40
+ componentState : [ ]
41
+ }
42
+ } ,
43
+ activeComponent : 'testComponent'
44
+ }
45
+ } )
46
+ describe ( 'Adding actions to components' , ( ) => {
47
+ it ( 'should add a single action to active component' , ( ) => {
48
+ mutations . ADD_TO_COMPONENT_ACTIONS ( state , 'testAction' )
49
+ expect ( state . componentMap [ state . activeComponent ] . componentActions ) . toEqual ( [ 'testAction' ] )
50
+ } )
51
+ } )
52
+ describe ( 'Adding state to components' , ( ) => {
53
+ it ( 'should add a single state string to active component' , ( ) => {
54
+ mutations . ADD_TO_COMPONENT_STATE ( state , 'testState' )
55
+ expect ( state . componentMap [ state . activeComponent ] . componentState ) . toEqual ( [ 'testState' ] )
56
+ } )
46
57
} )
47
58
} )
48
59
You can’t perform that action at this time.
0 commit comments