From 6d208d7d23001cd352ea8a5c3ee34affd8a5efcb Mon Sep 17 00:00:00 2001 From: popsiclelmlm Date: Wed, 13 May 2026 04:34:21 +0800 Subject: [PATCH 1/2] test: add interface plugin coverage --- .../components/button/Button.test.tsx | 38 +++++++++++++++++ .../components/select/index.test.tsx | 27 ++++++++++++ plugins/interface/index.test.tsx | 32 ++++++++++++++ plugins/interface/utils/index.test.tsx | 42 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 plugins/interface/components/button/Button.test.tsx create mode 100644 plugins/interface/components/select/index.test.tsx create mode 100644 plugins/interface/index.test.tsx create mode 100644 plugins/interface/utils/index.test.tsx diff --git a/plugins/interface/components/button/Button.test.tsx b/plugins/interface/components/button/Button.test.tsx new file mode 100644 index 0000000..2ff31c6 --- /dev/null +++ b/plugins/interface/components/button/Button.test.tsx @@ -0,0 +1,38 @@ +import { renderToString } from 'hono/jsx/dom/server' +import { describe, expect, it } from 'vitest' +import { Button } from './Button' + +describe('Button', () => { + it('renders a button with variant, size, title, and custom classes', () => { + const html = renderToString( + + ) + + expect(html).toContain('Icon') + }) + + it('uses anchor markup for href buttons and omits title text for square buttons', () => { + const html = renderToString( + + ) + + expect(html).toContain('Docs<') + expect(html).toContain('>D') + }) +}) diff --git a/plugins/interface/components/select/index.test.tsx b/plugins/interface/components/select/index.test.tsx new file mode 100644 index 0000000..364a1ae --- /dev/null +++ b/plugins/interface/components/select/index.test.tsx @@ -0,0 +1,27 @@ +import { renderToString } from 'hono/jsx/dom/server' +import { describe, expect, it, vi } from 'vitest' +import { Select } from './index' + +describe('Select', () => { + it('renders placeholder and options with the selected value', () => { + const html = renderToString( + + ) + + expect(html).toContain(' { + const html = renderToString( + + ) + + expect(html).toContain(' { + it('renders title and children', () => { + const html = renderToString( + + ) + + expect(html).toContain(' { + const html = renderToString( +