Skip to content

Commit

Permalink
feat: hide label on hidden input type
Browse files Browse the repository at this point in the history
  • Loading branch information
Benehiko committed Sep 25, 2023
1 parent 85cc979 commit 49ed854
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/react-components/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const InputField = ({
data-testid={dataTestid}
className={cn(className, gridStyle({ gap: 4 }))}
>
{title && (
{title && props.type !== "hidden" && (
<label
htmlFor={inputId}
className={typographyStyle({ size: "small", type: "regular" })}
Expand Down
28 changes: 28 additions & 0 deletions src/react-components/ory/helpers/node.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { test, expect } from "@playwright/experimental-ct-react"
import { Node } from "./node"

test("hidden input field shouldn't show label", async ({ mount }) => {
const component = await mount(
<Node
node={{
group: "default",
attributes: {
name: "name",
disabled: false,
type: "hidden",
node_type: "input",
label: {
type: "info",
text: "Hidden input",
id: 1234,
},
},
messages: [],
meta: {},
type: "input",
}}
/>,
)

await expect(component).toBeHidden()
})

0 comments on commit 49ed854

Please sign in to comment.