-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: implement component merging instead of usign lodash
- Loading branch information
1 parent
6cb5150
commit ed1439f
Showing
12 changed files
with
168 additions
and
105 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/elements-react/src/theme/default/components/default-component.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright © 2024 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { getOryComponents } from "./default-components" | ||
|
||
const CustomComponent = jest.fn() | ||
|
||
describe("DefaultComponent", () => { | ||
test("can override card component", () => { | ||
const result = getOryComponents({ | ||
Card: { AuthMethodListItem: CustomComponent }, | ||
}) | ||
expect(result.Card.AuthMethodListItem).toBe(CustomComponent) | ||
expect(result.Card.Content).toBeDefined() | ||
}) | ||
test("can override form component", () => { | ||
const result = getOryComponents({ | ||
Form: { OidcSettings: CustomComponent }, | ||
}) | ||
expect(result.Form.OidcSettings).toBe(CustomComponent) | ||
expect(result.Form.Root).toBeDefined() | ||
}) | ||
test("can override message component", () => { | ||
const result = getOryComponents({ | ||
Message: { Content: CustomComponent }, | ||
}) | ||
expect(result.Message.Content).toBe(CustomComponent) | ||
expect(result.Message.Root).toBeDefined() | ||
}) | ||
test("can override page component", () => { | ||
const result = getOryComponents({ | ||
Page: { Header: CustomComponent }, | ||
}) | ||
expect(result.Page.Header).toBe(CustomComponent) | ||
}) | ||
test("can override node component", () => { | ||
const result = getOryComponents({ | ||
Node: { Button: CustomComponent }, | ||
}) | ||
expect(result.Node.Button).toBe(CustomComponent) | ||
expect(result.Node.Input).toBeDefined() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.