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 = {
198198 delete state . componentMap [ payload . componentName ]
199199 state . routes [ state . activeRoute ] = compArr
200200 console . log ( 'new state' , state )
201-
201+ } ,
202+ [ types . ADD_TO_COMPONENT_ACTIONS ] : ( state , payload ) => {
203+ state . componentMap [ state . activeComponent ] . componentActions . push ( payload )
202204 }
203205}
204206
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export const UPDATE_OPEN_MODAL = 'UPDATE_OPEN_MODAL'
4141export const PARENT_SELECTED = 'PARENT_SELECTED'
4242export const DELETE_ROUTE = 'DELETE_ROUTE'
4343export const DELETE_COMPONENT = 'DELETE_COMPONENT'
44+ export const ADD_TO_COMPONENT_ACTIONS = 'ADD_TO_COMPONENT_ACTIONS'
4445
4546// Actions
4647export const registerComponent = 'registerComponent'
Original file line number Diff line number Diff line change 66import { mount , createLocalVue , shallowMount } from '@vue/test-utils'
77import QBUTTON from './demo/QBtn-demo.vue'
88import * as All from 'quasar'
9+ import mutations from '../../../src/store/mutations'
910// import langEn from 'quasar/lang/en-us' // change to any language you wish! => this breaks wallaby :(
1011const { Quasar, date } = All
1112
@@ -27,7 +28,22 @@ describe('Dummy test', () => {
2728} )
2829
2930describe ( '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+ } )
3147} )
3248
3349// describe('Mount Quasar', () => {
You can’t perform that action at this time.
0 commit comments