mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-05 02:41:49 +00:00
变更摘要: - 优化应用壳布局,统一 search 与 dashboard 的内容宽度与切换时机 - 恢复 search 与 dashboard 页面的上浮入场动画,并保留 sticky header 阴影效果 - 将本次新增前端测试收纳到 web/test/app,并纳入 TypeScript 检查范围 - 同步调整 landing quick start 文案字号与本地开发代理地址 关键文件: - web/src/app/layout.tsx - web/src/app/layout-main-content.ts - web/src/app/page-shell-style.ts - web/test/app/layout-main-content.test.ts - web/vite.config.ts
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
CENTERED_DASHBOARD_CONTENT_CLASS_NAME,
|
|
CENTERED_MAIN_CLASS_NAME,
|
|
CENTERED_SEARCH_CONTENT_CLASS_NAME,
|
|
DEFAULT_MAIN_CLASS_NAME,
|
|
getAppMainContentLayout,
|
|
resolveAppMainContentPathname,
|
|
} from '../../src/app/layout-main-content'
|
|
|
|
describe('getAppMainContentLayout', () => {
|
|
it('keeps the landing page full width without the app-shell padding wrapper', () => {
|
|
expect(getAppMainContentLayout('/')).toEqual({
|
|
mainClassName: 'flex-1 relative z-10',
|
|
contentClassName: '',
|
|
})
|
|
})
|
|
|
|
it('centers the search page content with roomier responsive gutters', () => {
|
|
const layout = getAppMainContentLayout('/search')
|
|
|
|
expect(layout).toEqual({
|
|
mainClassName: CENTERED_MAIN_CLASS_NAME,
|
|
contentClassName: CENTERED_SEARCH_CONTENT_CLASS_NAME,
|
|
})
|
|
expect(layout.contentClassName).toContain('max-w-[1200px]')
|
|
})
|
|
|
|
it('centers all dashboard sub-pages within a slightly narrower content frame', () => {
|
|
const layout = getAppMainContentLayout('/dashboard/skills')
|
|
|
|
expect(layout).toEqual({
|
|
mainClassName: CENTERED_MAIN_CLASS_NAME,
|
|
contentClassName: CENTERED_DASHBOARD_CONTENT_CLASS_NAME,
|
|
})
|
|
expect(layout.contentClassName).toContain('max-w-[1200px]')
|
|
})
|
|
|
|
it('leaves other non-landing routes on the default full-width app content layout', () => {
|
|
expect(getAppMainContentLayout('/space/acme/demo')).toEqual({
|
|
mainClassName: DEFAULT_MAIN_CLASS_NAME,
|
|
contentClassName: '',
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('resolveAppMainContentPathname', () => {
|
|
it('sticks with the last resolved route while the next page is still pending', () => {
|
|
expect(resolveAppMainContentPathname('/dashboard', '/search')).toBe('/search')
|
|
})
|
|
|
|
it('falls back to the live location when no resolved route is available yet', () => {
|
|
expect(resolveAppMainContentPathname('/search')).toBe('/search')
|
|
})
|
|
})
|