Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { SkeletonSwap } from '../src/components/interior/skeleton-swap';
|
|
|
|
describe('SkeletonSwap', () => {
|
|
it('reserves the requested space without painting a skeleton immediately', () => {
|
|
const html = renderToStaticMarkup(
|
|
<SkeletonSwap ready={false} reserve={84} lines={4} label="测试内容">
|
|
<div>尚未就绪</div>
|
|
</SkeletonSwap>,
|
|
);
|
|
|
|
expect(html).toContain('aria-busy="true"');
|
|
expect(html).toContain('height:84px');
|
|
expect(html).toContain('尚未就绪');
|
|
expect(html).not.toContain('aria-hidden="true"');
|
|
});
|
|
|
|
it('exposes ready content without a loading announcement', () => {
|
|
const html = renderToStaticMarkup(
|
|
<SkeletonSwap ready label="测试内容">
|
|
<div>内容已加载</div>
|
|
</SkeletonSwap>,
|
|
);
|
|
|
|
expect(html).toContain('aria-busy="false"');
|
|
expect(html).toContain('内容已加载');
|
|
expect(html).toContain('测试内容 loaded');
|
|
});
|
|
});
|