收口前端平台组件能力

新增 PlatformAsyncStatePanel 统一 profile 异步状态骨架
扩展 PlatformSegmentedTabs 支持滚动 tab 并接入创作入口与发现页
统一 PixelCloseButton 复用 PlatformModalCloseButton 像素关闭能力
抽取平台入口泥点前置提示弹层并收紧阻断语义
补充组件收口文档与共享决策记录
This commit is contained in:
2026-06-11 01:06:31 +08:00
parent edf37d97a7
commit 94122583ac
22 changed files with 897 additions and 445 deletions
@@ -1,7 +1,8 @@
/* @vitest-environment jsdom */
import { render, screen } from '@testing-library/react';
import { expect, test } from 'vitest';
import userEvent from '@testing-library/user-event';
import { expect, test, vi } from 'vitest';
import { PlatformModalCloseButton } from './PlatformModalCloseButton';
@@ -80,9 +81,37 @@ test('supports pixel close button', () => {
const button = screen.getByRole('button', { name: '关闭像素弹窗' });
expect(button.className).toContain('bg-black/20');
expect(button.className).toContain('bg-black/30');
expect(button.className).toContain('text-zinc-400');
expect(button.className).toContain('absolute');
expect(button.className).toContain('disabled:opacity-45');
expect(button.getAttribute('title')).toBe('关闭像素弹窗');
});
test('supports inline pixel placement and intercepted click behavior', async () => {
const user = userEvent.setup();
const onClick = vi.fn();
const onHeaderClick = vi.fn();
render(
<div onClick={onHeaderClick}>
<PlatformModalCloseButton
label="关闭像素标题栏"
variant="pixel"
placement="inline"
stopPropagation
onClick={onClick}
/>
</div>,
);
const button = screen.getByRole('button', { name: '关闭像素标题栏' });
await user.click(button);
expect(button.className).toContain('relative');
expect(button.className).toContain('shrink-0');
expect(onClick).toHaveBeenCalledTimes(1);
expect(onHeaderClick).not.toHaveBeenCalled();
});
test('supports editor dark close button', () => {