fix: 合并图库显示与操作入口

移除顶部主图统计,将刷新图库和批量生图改为带悬浮说明的图标按钮,并移动到布局切换按钮之后。
This commit is contained in:
GouJ
2026-09-08 13:40:10 +08:00
committed by GitHub
parent 7230f2238c
commit e912eada04
5 changed files with 243 additions and 241 deletions
+7 -8
View File
@@ -162,7 +162,7 @@ describe('全站平面主题', () => {
)
expect(css).toMatch(/\.asset-impact-links-scroll\.n-scrollbar\s*\{[^}]*height:\s*auto;[^}]*max-width:\s*100%;/)
expect(readFileSync('src/features/subject-images/SubjectImagesPage.vue', 'utf8')).toMatch(
/<WorkspacePage\b[^>]*>\s*<template #header>/
/<WorkspacePage\b[^>]*>\s*<template #default>/
)
})
@@ -183,13 +183,12 @@ describe('全站平面主题', () => {
it('图库顶部统一镜头选择和筛选的背景与垂直对齐,窄屏整组换行', () => {
// DOM 环境不计算几何;保护容器宽度断点和居中契约,真实坐标仍需浏览器验收。
const css = readAllStyles()
expect(css).toMatch(/\.gallery-workspace-page \.workspace-heading\s*\{[^}]*padding-block:\s*5px;/)
expect(css).toMatch(
/\.gallery-workspace-page \.workspace-toolbar,\s*\.gallery-workspace-page \.toolbar-summary,\s*\.gallery-workspace-page \.toolbar-actions\s*\{(?=[^}]*align-items:\s*center;)(?=[^}]*min-height:\s*34px;)/
)
expect(css).toMatch(
/@media \(min-width: 761px\)\s*\{[^}]*\.gallery-workspace-page \.toolbar-actions\s*\{[^}]*margin-left:\s*0;/
)
const source = readFileSync('src/features/subject-images/SubjectImagesPage.vue', 'utf8')
expect(source).not.toContain('class="toolbar-summary"')
expect(source).toMatch(/<WorkspaceTools\s+triggerless/)
expect(source.match(/<NPopover trigger="hover" placement="top">/g)).toHaveLength(2)
expect(source).toMatch(/aria-label="刷新图库"/)
expect(source).toMatch(/data-workspace-tools\s+aria-label="批量生图"/)
expect(css).toMatch(
/\.form-image-filter-region\s*\{[^}]*padding:\s*12px;[^}]*--app-field:\s*var\(--app-surface\);[^}]*--app-field-hover:\s*var\(--app-surface\);[^}]*background:\s*color-mix\(in srgb, var\(--app-subtle\) 96%, white\);/
)
@@ -174,7 +174,7 @@ describe('过期首帧到具体素材定位', () => {
await flushPromises()
expect(fetcher).toHaveBeenCalledTimes(count)
expect(wrapper!.get('.form-image-grid').element).toBe(grid)
const refresh = wrapper!.findAll('button').find(button => button.text().includes('刷新图库'))!
const refresh = wrapper!.get('[aria-label="刷新图库"]')
await refresh.trigger('click')
await flushPromises()
expect(fetcher.mock.calls.length).toBeGreaterThan(count)
@@ -185,7 +185,7 @@ describe('过期首帧到具体素材定位', () => {
it('切换镜头时筛选、关联说明和图片共用稳定纵向容器,长关联列表单独横向滚动', async () => {
const { keyframes, videos, references, fetcher } = await gallery('?sourceShotId=shot-target')
expect(wrapper!.find('.workspace-heading-scroll').exists()).toBe(true)
expect(wrapper!.find('.workspace-heading-scroll').exists()).toBe(false)
const scroll = wrapper!.get<HTMLElement>('.workspace-scroll > .n-scrollbar-container').element
const content = wrapper!.get('.workspace-scroll-content').element
const sticky = wrapper!.get('.gallery-sticky-controls').element
@@ -207,10 +207,7 @@ describe('过期首帧到具体素材定位', () => {
})
: original(url, init)
)
await wrapper!
.findAll('button')
.find(button => button.text() === '刷新图库')!
.trigger('click')
await wrapper!.get('[aria-label="刷新图库"]').trigger('click')
await flushPromises()
wrapper!
.findAllComponents(NSelect)
@@ -414,7 +411,7 @@ describe('过期首帧到具体素材定位', () => {
it('身份主图真的过期时显示独立顶部警告,并可从定位模式筛选所有过期素材', async () => {
const { first, router } = await gallery('?subjectFormId=form-other')
first.subject.identity = { id: 'identity-1', isLocked: true, images: [{ id: 'anchor-new' }] }
const refresh = wrapper!.findAll('button').find(button => button.text() === '刷新图库')!
const refresh = wrapper!.get('[aria-label="刷新图库"]')
await refresh.trigger('click')
await flushPromises()
expect(wrapper!.text()).toContain('形态主图需要更新')
@@ -432,10 +429,7 @@ describe('过期首帧到具体素材定位', () => {
it('仅视频接口报告过期时也显示警告,并明确两种检查不一致', async () => {
const { keyframes } = await gallery('?sourceShotId=shot-target&subjectFormId=form-special')
keyframes.items[0]!.primaryKeyframeStale = false
await wrapper!
.findAll('button')
.find(button => button.text() === '刷新图库')!
.trigger('click')
await wrapper!.get('[aria-label="刷新图库"]').trigger('click')
await flushPromises()
expect(wrapper!.get('[data-keyframe-impact]').text()).toContain('检查结果不一致')
expect(wrapper!.get('.form-image-card').text()).toContain('不要据此重复生图')
@@ -444,10 +438,7 @@ describe('过期首帧到具体素材定位', () => {
const { keyframes, videos } = await gallery('?sourceShotId=shot-target&subjectFormId=form-special')
keyframes.items[0]!.primaryKeyframeStale = false
videos.items[0]!.issues = []
await wrapper!
.findAll('button')
.find(button => button.text() === '刷新图库')!
.trigger('click')
await wrapper!.get('[aria-label="刷新图库"]').trigger('click')
await flushPromises()
expect(wrapper!.find('[data-keyframe-impact]').exists()).toBe(false)
expect(wrapper!.text()).toContain('未被标记为过期')
@@ -467,10 +458,7 @@ describe('过期首帧到具体素材定位', () => {
? Promise.resolve(new Response('{}', { status: 500 }))
: original(url, init)
)
await wrapper!
.findAll('button')
.find(button => button.text() === '刷新图库')!
.trigger('click')
await wrapper!.get('[aria-label="刷新图库"]').trigger('click')
await flushPromises()
expect(wrapper!.text()).toContain('暂时无法确认有无过期首帧')
expect(wrapper!.findAll('.form-image-card')).toHaveLength(3)