test(pl): 验证段证明刷新竞争和隐藏列筛选清理。
This commit is contained in:
1 parent
4cb2d88dab
commit
1ede95841c
1 file changed
+31
-1
@@ -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()
|
||||
})
|
||||
Reference in new issue
Block a user