From 4aba003a9e718c3e09374161a1672c6b4117fbe3 Mon Sep 17 00:00:00 2001 From: chenshoulin Date: Mon, 19 Oct 2026 17:21:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20Toast=20=E6=92=A4=E9=94=80=E5=8F=AF?= =?UTF-8?q?=E6=9A=82=E5=81=9C=EF=BC=8C=E5=AD=98=E5=82=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E4=B8=BA=E5=85=A8=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Toast 自动关闭支持悬停/聚焦暂停,移开后按剩余时间继续 - 存储异常提示移到 App 级,看板与今日视图都能看到 - 归档隐藏与筛选隐藏分开说明,并提示列内排序暂停原因 --- src/App.spec.ts | 17 ++++++++++ src/App.vue | 18 +++++++++-- src/components/ToastHost.spec.ts | 25 +++++++++++++-- src/components/ToastHost.vue | 4 +++ src/stores/toast.spec.ts | 46 +++++++++++++++++++++++++++ src/stores/toast.ts | 53 +++++++++++++++++++++++++++----- src/views/BoardView.spec.ts | 17 ++++++++-- src/views/BoardView.vue | 43 ++++++++++++++++++++------ 8 files changed, 198 insertions(+), 25 deletions(-) diff --git a/src/App.spec.ts b/src/App.spec.ts index 787d06c..5e01a05 100644 --- a/src/App.spec.ts +++ b/src/App.spec.ts @@ -5,6 +5,7 @@ import { createMemoryHistory } from 'vue-router' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { SCHEMA_VERSION } from '@/data/schema' +import { useTaskStore } from '@/stores/tasks' import App from './App.vue' import { createAppRouter } from './router' @@ -98,6 +99,22 @@ describe('App 端到端(真实 localStorage)', () => { expect(wrapper.findComponent({ name: 'PwaUpdatePrompt' }).exists()).toBe(true) wrapper.unmount() }) + + it('存储异常提示在应用级可见,切换视图也不消失', async () => { + const { wrapper, router } = await mountApp('/today') + + const store = useTaskStore() + store.notice = '本地存储不可用' + await nextTick() + + expect(wrapper.find('[role="alert"]').text()).toContain('本地存储不可用') + + await router.push('/') + await nextTick() + + expect(wrapper.find('[role="alert"]').text()).toContain('本地存储不可用') + wrapper.unmount() + }) }) describe('App 路由', () => { diff --git a/src/App.vue b/src/App.vue index 698b746..de95107 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,4 +1,5 @@