@@ -21,6 +21,7 @@ describe('useAccessStore', () => {
21
21
const store = useTabbarStore ( ) ;
22
22
const tab : any = {
23
23
fullPath : '/home' ,
24
+ key : 'home' ,
24
25
meta : { } ,
25
26
name : 'Home' ,
26
27
path : '/home' ,
@@ -35,6 +36,7 @@ describe('useAccessStore', () => {
35
36
const newTab : any = {
36
37
fullPath : '/new' ,
37
38
meta : { } ,
39
+ key : '/new' ,
38
40
name : 'New' ,
39
41
path : '/new' ,
40
42
} ;
@@ -46,12 +48,14 @@ describe('useAccessStore', () => {
46
48
const store = useTabbarStore ( ) ;
47
49
const initialTab : any = {
48
50
fullPath : '/existing' ,
49
- meta : { } ,
51
+ meta : {
52
+ fullPathKey : false ,
53
+ } ,
50
54
name : 'Existing' ,
51
55
path : '/existing' ,
52
56
query : { } ,
53
57
} ;
54
- store . tabs . push ( initialTab ) ;
58
+ store . addTab ( initialTab ) ;
55
59
const updatedTab = { ...initialTab , query : { id : '1' } } ;
56
60
store . addTab ( updatedTab ) ;
57
61
expect ( store . tabs . length ) . toBe ( 1 ) ;
@@ -157,7 +161,7 @@ describe('useAccessStore', () => {
157
161
path : '/contact' ,
158
162
} as any ) ;
159
163
160
- await store . _bulkCloseByPaths ( [ '/home' , '/contact' ] ) ;
164
+ await store . _bulkCloseByKeys ( [ '/home' , '/contact' ] ) ;
161
165
162
166
expect ( store . tabs ) . toHaveLength ( 1 ) ;
163
167
expect ( store . tabs [ 0 ] ?. name ) . toBe ( 'About' ) ;
@@ -183,9 +187,8 @@ describe('useAccessStore', () => {
183
187
name : 'Contact' ,
184
188
path : '/contact' ,
185
189
} ;
186
- store . addTab ( targetTab ) ;
187
-
188
- await store . closeLeftTabs ( targetTab ) ;
190
+ const addTargetTab = store . addTab ( targetTab ) ;
191
+ await store . closeLeftTabs ( addTargetTab ) ;
189
192
190
193
expect ( store . tabs ) . toHaveLength ( 1 ) ;
191
194
expect ( store . tabs [ 0 ] ?. name ) . toBe ( 'Contact' ) ;
@@ -205,15 +208,15 @@ describe('useAccessStore', () => {
205
208
name : 'About' ,
206
209
path : '/about' ,
207
210
} ;
208
- store . addTab ( targetTab ) ;
211
+ const addTargetTab = store . addTab ( targetTab ) ;
209
212
store . addTab ( {
210
213
fullPath : '/contact' ,
211
214
meta : { } ,
212
215
name : 'Contact' ,
213
216
path : '/contact' ,
214
217
} as any ) ;
215
218
216
- await store . closeOtherTabs ( targetTab ) ;
219
+ await store . closeOtherTabs ( addTargetTab ) ;
217
220
218
221
expect ( store . tabs ) . toHaveLength ( 1 ) ;
219
222
expect ( store . tabs [ 0 ] ?. name ) . toBe ( 'About' ) ;
@@ -227,7 +230,7 @@ describe('useAccessStore', () => {
227
230
name : 'Home' ,
228
231
path : '/home' ,
229
232
} ;
230
- store . addTab ( targetTab ) ;
233
+ const addTargetTab = store . addTab ( targetTab ) ;
231
234
store . addTab ( {
232
235
fullPath : '/about' ,
233
236
meta : { } ,
@@ -241,7 +244,7 @@ describe('useAccessStore', () => {
241
244
path : '/contact' ,
242
245
} as any ) ;
243
246
244
- await store . closeRightTabs ( targetTab ) ;
247
+ await store . closeRightTabs ( addTargetTab ) ;
245
248
246
249
expect ( store . tabs ) . toHaveLength ( 1 ) ;
247
250
expect ( store . tabs [ 0 ] ?. name ) . toBe ( 'Home' ) ;
0 commit comments