perf(short-drama-agent-front): 优化制作工作台交互与移动端布局

This commit is contained in:
GJ committed 2026-10-10 19:28:47 +08:00
1 parent b5eaed3981
commit 54a381ebd3
37 files changed
+1217 -426

No files matched your search

+14 -1
View File
@@ -1,7 +1,20 @@
import { describe, expect, it } from 'vitest'
import { masonryRowSpan } from '@/features/subject-images/layout'
import { masonryColumnCount, masonryRowSpan } from '@/features/subject-images/layout'
describe('图库瀑布流卡片布局', () => {
it('从桌面缩窄到手机时重新按可用宽度计算列数', () => {
expect(masonryColumnCount(2164, 260, 12)).toBe(8)
expect(masonryColumnCount(363, 260, 12)).toBe(1)
expect(masonryColumnCount(240, 260, 12)).toBe(1)
expect(masonryColumnCount(531, 260, 12)).toBe(1)
expect(masonryColumnCount(532, 260, 12)).toBe(2)
})
it('容器尚未布局或尺寸无效时保留单列', () => {
expect(masonryColumnCount(0, 260, 12)).toBe(1)
expect(masonryColumnCount(363, Number.NaN, 12)).toBe(1)
expect(masonryColumnCount(363, 260, -1)).toBe(1)
})
it('按卡片实际高度计算网格跨度', () => {
expect(masonryRowSpan(420, 1, 20)).toBe(21)
expect(masonryRowSpan(421, 1, 20)).toBe(21)