fix: header theme color error (#4170)

* fix: header theme color error

* fix: ci error

* fix: ci error
This commit is contained in:
Vben
2024-08-16 22:47:28 +08:00
committed by GitHub
parent 0faf7810b6
commit 66808582ff
9 changed files with 473 additions and 520 deletions

View File

@@ -55,7 +55,7 @@ describe('useAccessStore', () => {
const updatedTab = { ...initialTab, query: { id: '1' } };
store.addTab(updatedTab);
expect(store.tabs.length).toBe(1);
expect(store.tabs[0].query).toEqual({ id: '1' });
expect(store.tabs[0]?.query).toEqual({ id: '1' });
});
it('closes all tabs', async () => {
@@ -67,7 +67,7 @@ describe('useAccessStore', () => {
await store.closeAllTabs(router);
expect(store.tabs.length).toBe(0); // 假设没有固定的标签页
expect(store.tabs.length).toBe(1); // 假设没有固定的标签页
// expect(router.replace).toHaveBeenCalled();
});

View File

@@ -147,7 +147,8 @@ export const useTabbarStore = defineStore('core-tabbar', {
* @zh_CN 关闭所有标签页
*/
async closeAllTabs(router: Router) {
this.tabs = this.tabs.filter((tab) => isAffixTab(tab));
const newTabs = this.tabs.filter((tab) => isAffixTab(tab));
this.tabs = newTabs.length > 0 ? newTabs : [...this.tabs].splice(0, 1);
await this._goToDefaultTab(router);
this.updateCacheTab();
},