SnowLuma v2.4.2 source snapshot
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
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
This commit is contained in:
commit
fa9c73363d
1367 files changed
+355735
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { OtpInput } from '../src/components/interior/otp-input';
|
||||
|
||||
describe('OtpInput official error/hint contract', () => {
|
||||
it('shows the hint while error is false', () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<OtpInput
|
||||
label="验证码"
|
||||
hint="可以把完整验证码粘贴到任意一格。"
|
||||
error={false}
|
||||
errorMessage="验证码不正确,改错的那一位即可。"
|
||||
/>,
|
||||
);
|
||||
expect(markup).toContain('可以把完整验证码粘贴到任意一格。');
|
||||
expect(markup).not.toContain('验证码不正确,改错的那一位即可。');
|
||||
});
|
||||
|
||||
it('swaps to the error message when error is true', () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<OtpInput
|
||||
label="验证码"
|
||||
hint="可以把完整验证码粘贴到任意一格。"
|
||||
error
|
||||
errorMessage="验证码不正确,改错的那一位即可。"
|
||||
/>,
|
||||
);
|
||||
expect(markup).toContain('验证码不正确,改错的那一位即可。');
|
||||
expect(markup).toContain('aria-invalid="true"');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user