From 1ede95841c1d1777d8de8d9a3369016818d5c134 Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Sun, 1 Nov 2026 23:16:10 +0800 Subject: [PATCH] =?UTF-8?q?test(pl):=20=E9=AA=8C=E8=AF=81=E6=AE=B5?= =?UTF-8?q?=E8=AF=81=E6=98=8E=E5=88=B7=E6=96=B0=E7=AB=9E=E4=BA=89=E5=92=8C?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=88=97=E7=AD=9B=E9=80=89=E6=B8=85=E7=90=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-admin/scripts/stop-documents.test.ts | 32 +++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/web-admin/scripts/stop-documents.test.ts b/web-admin/scripts/stop-documents.test.ts index 6e414cf05..928230d34 100644 --- a/web-admin/scripts/stop-documents.test.ts +++ b/web-admin/scripts/stop-documents.test.ts @@ -81,7 +81,7 @@ function harness(fixed?: string) { const state = scope.run(() => new Function( ...Object.keys(env), - `${code}; return { rows, details, load, loadDetail, allowed, canUpload, keyword, setFilterState, page, total, expansionStyle, open, save, visible, editing, upload, saving, editorLoading, status, search, statusLabel }` + `${code}; return { rows, details, load, loadDetail, allowed, canUpload, keyword, setFilterState, page, total, expansionStyle, open, save, visible, editing, upload, saving, editorLoading, status, search, statusLabel, reset, visibleColumns }` )(...Object.values(env)) ) return { @@ -509,3 +509,33 @@ test('status is a server single filter and combines with the number filter', asy await flush() h.stop() }) + +test('latest refresh wins and hidden column/reset preserve server filter semantics', async () => { + const h = harness(), + s = h.state + h.permissions[0].resolve({ all: true }) + await flush() + const fresh = s.load() + h.calls[1].resolve({ list: [{ id: 'new' }], total: 45 }) + await fresh + h.calls[0].resolve({ list: [{ id: 'old' }], total: 1 }) + await flush() + assert.equal(s.rows.value[0].id, 'new') + assert.equal(s.total.value, 45) + s.keyword.value = 'quick' + s.status.value = 'pending' + s.page.value = 2 + s.setFilterState('planNo', { text: 'PL' }) + assert.equal(s.page.value, 1) + assert.equal(h.calls.at(-1).args[0].planNo, 'PL') + s.visibleColumns.value = s.visibleColumns.value.filter((key: string) => key !== 'planNo') + await vue.nextTick() + assert.equal(h.calls.at(-1).args[0].planNo, undefined) + assert.equal(h.calls.at(-1).args[0].status, 'pending') + s.reset() + assert.equal(h.calls.at(-1).args[0].keyword, '') + assert.equal(h.calls.at(-1).args[0].status, undefined) + h.calls.forEach((c) => c.resolve({ list: [], total: 0 })) + await flush() + h.stop() +})