File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,9 @@ const mutations = {
198
198
delete state . componentMap [ payload . componentName ]
199
199
state . routes [ state . activeRoute ] = compArr
200
200
console . log ( 'new state' , state )
201
-
201
+ } ,
202
+ [ types . ADD_TO_COMPONENT_ACTIONS ] : ( state , payload ) => {
203
+ state . componentMap [ state . activeComponent ] . componentActions . push ( payload )
202
204
}
203
205
}
204
206
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export const UPDATE_OPEN_MODAL = 'UPDATE_OPEN_MODAL'
41
41
export const PARENT_SELECTED = 'PARENT_SELECTED'
42
42
export const DELETE_ROUTE = 'DELETE_ROUTE'
43
43
export const DELETE_COMPONENT = 'DELETE_COMPONENT'
44
+ export const ADD_TO_COMPONENT_ACTIONS = 'ADD_TO_COMPONENT_ACTIONS'
44
45
45
46
// Actions
46
47
export const registerComponent = 'registerComponent'
Original file line number Diff line number Diff line change 6
6
import { mount , createLocalVue , shallowMount } from '@vue/test-utils'
7
7
import QBUTTON from './demo/QBtn-demo.vue'
8
8
import * as All from 'quasar'
9
+ import mutations from '../../../src/store/mutations'
9
10
// import langEn from 'quasar/lang/en-us' // change to any language you wish! => this breaks wallaby :(
10
11
const { Quasar, date } = All
11
12
@@ -27,7 +28,22 @@ describe('Dummy test', () => {
27
28
} )
28
29
29
30
describe ( 'Adding actions to components' , ( ) => {
30
-
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' ] )
46
+ } )
31
47
} )
32
48
33
49
// describe('Mount Quasar', () => {
You can’t perform that action at this time.
0 commit comments