File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ suite('vuex tab', () => {
23
23
24
24
it ( 'should filter state & getters' , ( ) => {
25
25
cy . get ( '.right .search input' ) . clear ( ) . type ( 'cou' )
26
- cy . get ( '.data-field' ) . should ( 'have.length' , 1 )
26
+ cy . get ( '.data-field' ) . should ( 'have.length' , 2 )
27
27
cy . get ( '.right .search input' ) . clear ( ) . type ( 'no value' )
28
28
cy . get ( '.data-field' ) . should ( 'have.length' , 0 )
29
29
cy . get ( '.right .search input' ) . clear ( )
@@ -59,6 +59,11 @@ suite('vuex tab', () => {
59
59
expect ( el . text ( ) ) . to . include ( 'type:"INCREMENT"' )
60
60
expect ( el . text ( ) ) . to . include ( 'count:2' )
61
61
} )
62
+ cy . get ( '.data-field .key' ) . contains ( 'lastCountPayload' ) . click ( )
63
+ cy . get ( '.vuex-state-inspector' ) . then ( el => {
64
+ expect ( el . text ( ) ) . to . include ( 'a:1' )
65
+ expect ( el . text ( ) ) . to . include ( 'b:Object' )
66
+ } )
62
67
cy . get ( '#target' ) . iframe ( ) . then ( ( { get } ) => {
63
68
get ( '#counter p' ) . contains ( '1' )
64
69
} )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export default new Vuex.Store({
7
7
state : {
8
8
inited : 0 ,
9
9
count : 0 ,
10
+ lastCountPayload : null ,
10
11
date : new Date ( ) ,
11
12
set : new Set ( ) ,
12
13
map : new Map ( ) ,
@@ -23,8 +24,14 @@ export default new Vuex.Store({
23
24
} ,
24
25
mutations : {
25
26
TEST_INIT : state => state . inited ++ ,
26
- INCREMENT : state => state . count ++ ,
27
- DECREMENT : state => state . count -- ,
27
+ INCREMENT : ( state , payload ) => {
28
+ state . count ++
29
+ state . lastCountPayload = payload
30
+ } ,
31
+ DECREMENT : ( state , payload ) => {
32
+ state . count --
33
+ state . lastCountPayload = payload
34
+ } ,
28
35
UPDATE_DATE : state => {
29
36
state . date = new Date ( )
30
37
} ,
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ export function initVuexBackend (hook, bridge) {
146
146
// Replay mutations
147
147
for ( let i = snapshot . index + 1 ; i <= index ; i ++ ) {
148
148
const mutation = mutations [ i ]
149
- mutation . handlers . forEach ( handler => handler ( state , mutation . payload ) )
149
+ mutation . handlers . forEach ( handler => handler ( mutation . payload ) )
150
150
if ( i !== index && i % SharedData . cacheVuexSnapshotsEvery === 0 ) {
151
151
takeSnapshot ( i , state )
152
152
}
You can’t perform that action at this time.
0 commit comments