task-273(验收反馈): 店铺数据卡片宫格排(一行3个/一页9张+卡片分页)

This commit is contained in:
2026-09-06 01:48:57 +08:00
parent 8add3ceaa4
commit 0315a3a93d
4 changed files with 65 additions and 6 deletions
@@ -0,0 +1,39 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
// 验收反馈:店铺数据记录卡片用宫格排(一行 3 个、一页 9 张卡片)+ 分页组件翻页。
const PAGE = 'src/pages/tasks/ShopDataTasksPage.vue'
test('align_shop_data_grid_normal_primary_path', () => {
const src = readSource(PAGE)
assert.match(src, /grid-template-columns:\s*repeat\(3,\s*1fr\)/, '卡片容器应为 3 列宫格')
})
test('align_shop_data_grid_normal_variant_input', () => {
const src = readSource(PAGE)
assert.match(src, /cardPageSize\s*=\s*9|pageSize\s*=\s*9/, '卡片分页每页 9 张')
assert.match(src, /cardPage\b/, '应有卡片页状态')
assert.match(src, /pagedResultRows|cardPageRows/, '卡片应绑定按 9 张切片的数据')
})
test('align_shop_data_grid_boundary_empty_input', () => {
// 卡片区下方有翻页组件(prev/next),与店铺分页并存。
const src = readSource(PAGE)
const count = (src.match(/el-pagination/g) || []).length
assert.ok(count >= 2, '页面应含店铺分页 + 卡片分页两处 el-pagination')
assert.match(src, /layout="prev, pager, next"/, '卡片分页含上一页/下一页')
})
test('align_shop_data_grid_boundary_single_item', () => {
// 卡片渲染绑定分页后的数组而非全量。
const src = readSource(PAGE)
assert.match(src, /v-for="row in pagedResultRows"/, '卡片 v-for 使用分页后数组')
})
test('align_shop_data_grid_repeated_operation_is_idempotent', () => {
// 切店铺页时卡片页重置为第一页,避免空页。
const src = readSource(PAGE)
assert.match(src, /cardPage\s*(?:\.value)?\s*=\s*1/, '切页需重置卡片页到 1')
})