Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(web): 核对紧凑控件与窄屏卡片高度

longmeidao611601392337
diff --git a/frontend/e2e/card-collections.test.ts b/frontend/e2e/card-collections.test.ts
index 65a080a8a..f7e3d427b 100644
--- a/frontend/e2e/card-collections.test.ts
+++ b/frontend/e2e/card-collections.test.ts
@@ -10,7 +10,7 @@ describe('卡片信息与收藏入口', () => {
before(async () => { browser = await launch() });
after(async () => { await browser.close() });
for (const viewport of VIEWPORTS) {
- it(`${viewport.name} 标题与署名相邻,标签有间距,卡片同高`, async () => {
+ it(`${viewport.name} 标题与署名相邻,标签有间距,${viewport.mobile ? '卡片按内容定高' : '同排卡片等高'}`, async () => {
const opened = await openFollowFeed(browser, '/follow', viewport);
try {
assert.equal(await opened.page.locator('[data-follow-filter-glass]').getByRole('button', { name: '我的收藏', exact: true }).count(), 1);
@@ -29,10 +29,19 @@ describe('卡片信息与收藏入口', () => {
const rows = await inspect();
assert(rows[0].title >= rows[0].line * 1.9 && rows[1].title < rows[1].line * 1.5, JSON.stringify(rows));
assert(rows.every(row => row.gap >= 4 && row.gap <= 8 && row.labelGap >= 8 && row.labelGap <= 12), JSON.stringify(rows));
- assert(Math.max(...rows.map(row => row.height)) - Math.min(...rows.map(row => row.height)) <= 1, JSON.stringify(rows));
+ if (viewport.mobile) {
+ assert(Math.abs((rows[0].height - rows[1].height) - (rows[0].title - rows[1].title)) <= 1, JSON.stringify(rows));
+ } else {
+ assert(Math.max(...rows.map(row => row.height)) - Math.min(...rows.map(row => row.height)) <= 1, JSON.stringify(rows));
+ }
await opened.page.evaluate(() => { document.body.dataset.density = 'dense' });
const dense = await inspect();
- assert(dense.every(row => row.title < row.line * 1.5 && row.labelGap >= 8 && row.labelGap <= 12), JSON.stringify(dense));
+ assert(dense.every(row => row.title < row.line * (viewport.mobile ? 2.1 : 1.5)
+ && row.labelGap >= 8 && row.labelGap <= 12), JSON.stringify(dense));
+ if (viewport.mobile) {
+ assert(dense[0].title >= dense[0].line * 1.9, JSON.stringify(dense));
+ assert(Math.abs((dense[0].height - dense[1].height) - (dense[0].title - dense[1].title)) <= 1, JSON.stringify(dense));
+ }
} finally { await opened.close() }
});
it(`${viewport.name} 收藏入口是紧凑图标按钮,播放媒体没有侧箭头`, async () => {
diff --git a/frontend/e2e/design-controls.test.ts b/frontend/e2e/design-controls.test.ts
index d6fb860ad..2b740a136 100644
--- a/frontend/e2e/design-controls.test.ts
+++ b/frontend/e2e/design-controls.test.ts
@@ -726,9 +726,9 @@ describe('设计决定:控件、状态与首页顶部', () => {
}
});
- it('首页标签:没加上去是 --field-ring-hover 的虚线,加上去是玻璃上那圈实线,视图不画虚线;触屏上排 52、视图与标签 36', { timeout: 60_000 }, async () => {
+ it('首页标签:没加上去是 --field-ring-hover 的虚线,加上去是玻璃上那圈实线,视图不画虚线;触屏上排 48、视图与标签 30', { timeout: 60_000 }, async () => {
/* 虚线只说「这条筛选可加、此刻没加」,取 Vercel 筛选令牌未生效那一档;四枚视图恒有一枚生效,不画。
- 圆角同卡片、详情与交集条那一颗(`--tag-radius`)。触屏上 30px 不够一枚指尖。 */
+ 圆角同卡片、详情与交集条那一颗(`--tag-radius`)。触屏控件共用 30px 高度。 */
const opened = await openCatalogBars(browser);
try {
const { page } = opened;
@@ -765,7 +765,7 @@ describe('设计决定:控件、状态与首页顶部', () => {
return { coarse: matchMedia('(pointer: coarse)').matches, row: height('[data-filter-row="top"]'),
view: height('[data-catalog-view]'), tag: height('[data-catalog-tag]') };
});
- assert.deepEqual(heights, { coarse: true, row: 52, view: 36, tag: 36 }, '触屏上筛选条上排没有放大到指尖尺寸');
+ assert.deepEqual(heights, { coarse: true, row: 48, view: 30, tag: 30 }, '触屏筛选按钮高度不一致');
} finally {
await phone.close();
}