task-272(验收反馈): 分组/软件版本/类目搜索表补齐分页组件(prev/next 中文由 locale 提供)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readSource } from './helpers.ts'
|
||||
|
||||
// 验收反馈:所有列表都要加分页组件(上一页/下一页,中文由全局 locale 提供)。
|
||||
// 本轮补齐缺分页的列表:分组管理、软件版本、商品类目搜索表。
|
||||
// 菜单管理是树结构(非列表),商品类目树用懒加载+加载更多节点,均豁免。
|
||||
|
||||
test('align_pagination_normal_primary_path', () => {
|
||||
for (const page of [
|
||||
'src/pages/account/GroupsPage.vue',
|
||||
'src/pages/records/RecordsSoftwareVersionPage.vue',
|
||||
'src/pages/asin/ProductCategoryPage.vue',
|
||||
]) {
|
||||
const src = readSource(page)
|
||||
assert.match(src, /el-pagination/, `${page} 应包含分页组件`)
|
||||
}
|
||||
})
|
||||
|
||||
test('align_pagination_normal_variant_input', () => {
|
||||
// 分页组件需含上一页/下一页(prev/next),中文文案由全局 zh-cn locale 渲染。
|
||||
for (const page of [
|
||||
'src/pages/account/GroupsPage.vue',
|
||||
'src/pages/records/RecordsSoftwareVersionPage.vue',
|
||||
'src/pages/asin/ProductCategoryPage.vue',
|
||||
]) {
|
||||
const src = readSource(page)
|
||||
assert.match(src, /el-pagination[^>]*layout="[^"]*prev[^"]*next/, `${page} 分页 layout 需含 prev/next`)
|
||||
}
|
||||
})
|
||||
|
||||
test('align_pagination_boundary_empty_input', () => {
|
||||
// 分组/软件版本为全量拉取,走客户端切片分页(computed 按 page/pageSize 切)。
|
||||
for (const page of ['src/pages/account/GroupsPage.vue', 'src/pages/records/RecordsSoftwareVersionPage.vue']) {
|
||||
const src = readSource(page)
|
||||
assert.match(src, /pagedRows|pageRows|pageItems|pagedItems/, `${page} 应有客户端分页切片`)
|
||||
assert.match(src, /:data="paged/, `${page} 表格应绑定分页后的数据`)
|
||||
}
|
||||
})
|
||||
|
||||
test('align_pagination_boundary_single_item', () => {
|
||||
// 类目搜索表从“加载更多”累加改为 el-pagination 换页模式:不再有加载更多按钮与累加拼接。
|
||||
const src = readSource('src/pages/asin/ProductCategoryPage.vue')
|
||||
assert.ok(!src.includes('加载更多搜索结果'), '搜索表不应再有“加载更多搜索结果”按钮')
|
||||
assert.ok(!src.includes('[...searchRows.value, ...result.items]'), '搜索表不应再累加拼接结果')
|
||||
})
|
||||
|
||||
test('align_pagination_repeated_operation_is_idempotent', () => {
|
||||
// 已有分页的页面(12 页)保持原样,不被破坏。
|
||||
for (const page of [
|
||||
'src/pages/account/UsersPage.vue',
|
||||
'src/pages/asin/AsinInvalidPage.vue',
|
||||
'src/pages/shop/ShopManagePage.vue',
|
||||
]) {
|
||||
const src = readSource(page)
|
||||
assert.match(src, /el-pagination/, `${page} 既有分页保留`)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user