mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Internal renames so source matches the published @hanzogui/[email protected] dist (Gui.ts, createGui.ts, views/GuiProvider.mjs, views/GuiRoot.mjs). Renames applied: - Files: Hanzogui.ts -> Gui.ts, createHanzogui.ts -> createGui.ts, HanzoguiProvider.tsx -> GuiProvider.tsx, HanzoguiRoot[.native].tsx -> GuiRoot[.native].tsx, HanzoguiPlugin.ts -> GuiPlugin.ts, withHanzogui.ts -> withGui.ts, loadHanzogui.ts -> loadGui.ts, v4-hanzogui.ts -> v4-gui.ts, *.d.ts mirrors, hanzogui.config.ts -> gui.config.ts, hanzogui.build.ts -> gui.build.ts, hanzogui.css -> gui.css, hanzogui-build.js -> gui-build.js, etc. - Directories: pkgs/core/create-hanzogui -> pkgs/core/create-gui, apps/sandbox/config/hanzogui -> apps/sandbox/config/gui. - Identifiers: Hanzogui* -> Gui*, createHanzogui -> createGui, withHanzogui -> withGui, loadHanzogui -> loadGui, HANZOGUI_* env -> GUI_*, __hanzogui* globals -> __gui*, hanzoguiOptions/hanzoguiConfig/ hanzoguiPlugin etc. -> guiOptions/guiConfig/guiPlugin, CSS vars --hanzogui-* -> --gui-*, data-hanzogui-* -> data-gui-*, [hanzogui] log prefix -> [gui]. - Removed duplicate pkgs/packages/hanzogui-dev-config; the canonical pkgs/packages/gui-dev-config (@hanzogui/dev-config) already existed with the correct shape. apps/demos now consumes @hanzogui/dev-config. Preserved (public npm names): - "hanzogui" umbrella package (pkgs/ui/hanzogui/package.json) - "@hanzogui/*" namespace - "hanzogui-loader" package name (pkgs/compiler/loader) - "hanzogui-build-test-*" test fixture names - "hanzogui-publish-smoke" workflow id - pkgs/core/helpers-hanzogui dir (not on rename list) - apps/gui.hanzo.ai/ marketing site directory - AGENTS.md symlink restored after perl -i clobbered it Smoke build (turbo run build): 169/169 workspaces successful. Sample tests: pkgs/core/core-test getSplitStyles.android* + createGui.web all green.
111 lines
3.7 KiB
TypeScript
111 lines
3.7 KiB
TypeScript
import '@testing-library/jest-dom'
|
|
import { Input } from '@hanzogui/input'
|
|
import { getDefaultGuiConfig } from '@hanzogui/config-default'
|
|
import { View, GuiProvider, createGui } from '@hanzogui/core'
|
|
import { render } from '@testing-library/react'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const conf = createGui(getDefaultGuiConfig())
|
|
|
|
function InputTest(props: React.ComponentProps<typeof Input>) {
|
|
return (
|
|
<GuiProvider config={conf} defaultTheme="light">
|
|
<View>
|
|
<Input {...props} />
|
|
</View>
|
|
</GuiProvider>
|
|
)
|
|
}
|
|
|
|
describe('Input web type prop', () => {
|
|
it('should render with type="number"', () => {
|
|
const { container } = render(<InputTest type="number" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'number')
|
|
})
|
|
|
|
it('should render with type="email"', () => {
|
|
const { container } = render(<InputTest type="email" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'email')
|
|
})
|
|
|
|
it('should render with type="tel"', () => {
|
|
const { container } = render(<InputTest type="tel" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'tel')
|
|
})
|
|
|
|
it('should render with type="password"', () => {
|
|
const { container } = render(<InputTest type="password" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'password')
|
|
})
|
|
|
|
it('should render with type="url"', () => {
|
|
const { container } = render(<InputTest type="url" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'url')
|
|
})
|
|
|
|
it('should render with type="search"', () => {
|
|
const { container } = render(<InputTest type="search" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('type', 'search')
|
|
})
|
|
})
|
|
|
|
describe('Input web inputMode prop', () => {
|
|
it('should render with inputMode="numeric"', () => {
|
|
const { container } = render(<InputTest inputMode="numeric" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('inputmode', 'numeric')
|
|
})
|
|
|
|
it('should render with inputMode="decimal"', () => {
|
|
const { container } = render(<InputTest inputMode="decimal" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('inputmode', 'decimal')
|
|
})
|
|
|
|
it('should render with inputMode="email"', () => {
|
|
const { container } = render(<InputTest inputMode="email" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('inputmode', 'email')
|
|
})
|
|
|
|
it('should render with inputMode="tel"', () => {
|
|
const { container } = render(<InputTest inputMode="tel" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('inputmode', 'tel')
|
|
})
|
|
})
|
|
|
|
describe('Input web default behavior', () => {
|
|
it('should render an input element', () => {
|
|
const { container } = render(<InputTest />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toBeTruthy()
|
|
})
|
|
|
|
it('should support placeholder', () => {
|
|
const { container } = render(<InputTest placeholder="Enter text" />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveAttribute('placeholder', 'Enter text')
|
|
})
|
|
|
|
it('should support disabled', () => {
|
|
const { container } = render(<InputTest disabled />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toBeDisabled()
|
|
})
|
|
})
|
|
|
|
describe('Input autoFocus', () => {
|
|
it('should focus the input element on mount when autoFocus is set', () => {
|
|
const { container } = render(<InputTest autoFocus />)
|
|
const input = container.querySelector('input')
|
|
expect(input).toHaveFocus()
|
|
})
|
|
})
|