From dd1bbccf911c3aaa863efd4b4c9f56c97200f73b Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:19:30 +0200 Subject: [PATCH] chore: cleanup auth code section logic and tests --- .../ory/sections/auth-code-section.spec.tsx | 74 +++++++++++++++++++ .../ory/sections/auth-code-section.tsx | 7 +- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/src/react-components/ory/sections/auth-code-section.spec.tsx b/src/react-components/ory/sections/auth-code-section.spec.tsx index 5e90c4cef..20ce378c6 100644 --- a/src/react-components/ory/sections/auth-code-section.spec.tsx +++ b/src/react-components/ory/sections/auth-code-section.spec.tsx @@ -104,3 +104,77 @@ test("shouldn't render anything with no code group", async ({ mount }) => { await expect(container.locator("input[name=identifier]")).not.toBeVisible() }) + +test("should render traits on default group", async ({ mount }) => { + const container = await mount( + , + ) + + await expect(container.locator("input[name='traits.email']")).toBeVisible() + await expect(container.locator("input[name='traits.name']")).toBeVisible() + await expect(container.locator("button[name=method]")).toBeVisible() +}) diff --git a/src/react-components/ory/sections/auth-code-section.tsx b/src/react-components/ory/sections/auth-code-section.tsx index 33bfc6aaf..2d29db2cb 100644 --- a/src/react-components/ory/sections/auth-code-section.tsx +++ b/src/react-components/ory/sections/auth-code-section.tsx @@ -18,7 +18,8 @@ export const AuthCodeSection = ({ filter={{ nodes: nodes, groups: "code", - excludeAttributes: ["submit", "hidden"], + withoutDefaultAttributes: true, + excludeAttributes: ["hidden", "button", "submit"], // the form will take care of hidden fields }} /> @@ -28,8 +29,8 @@ export const AuthCodeSection = ({ filter={{ nodes: nodes, groups: "code", - withoutDefaultGroup: true, - attributes: ["submit", "hidden"], + withoutDefaultAttributes: true, + attributes: ["button", "submit"], }} />