-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from DevNode-Dev/feat/connect-wallet-create-did
Added did gen on wallet connect
- Loading branch information
Showing
6 changed files
with
103 additions
and
143 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
apps/web/src/components/Button/PrimaryButton/PrimaryButton.test.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,30 @@ | ||
import {fireEvent, render, screen} from "@testing-library/react"; | ||
import {PrimaryButton} from "./PrimaryButton"; | ||
|
||
describe("<PrimaryButton />", () => { | ||
it("should render the button with no issues", () => { | ||
const result = render(<PrimaryButton title={"button"} onClick={jest.fn} />); | ||
expect(result.container).toBeInTheDocument(); | ||
expect(screen.getByRole("button")).not.toBeDisabled(); | ||
}); | ||
|
||
it("should be disabled if the props has disabled=true", () => { | ||
render(<PrimaryButton title={"button"} disabled={true} onClick={jest.fn} />); | ||
const button = screen.getByRole("button"); | ||
expect(button).toBeTruthy(); | ||
expect(button).toBeDisabled(); | ||
}); | ||
|
||
it("should handle click event", () => { | ||
const onClick = jest.fn(); | ||
render(<PrimaryButton title={"button"} onClick={onClick} />); | ||
fireEvent.click(screen.getByRole("button")); | ||
expect(onClick).toBeCalled(); | ||
}); | ||
|
||
it("should handle custom class names", () => { | ||
const custom = "my-custom-class"; | ||
render(<PrimaryButton title={"button"} onClick={jest.fn} classes={custom} />); | ||
expect(screen.getByRole("button")).toHaveClass(custom); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
apps/web/src/components/Button/PrimaryButton/PrimaryButton.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,15 @@ | ||
import {ButtonProps} from "../types"; | ||
|
||
export const PrimaryButton = (props: ButtonProps) => { | ||
return ( | ||
<button | ||
type="button" | ||
id="primary-button" | ||
className={`cursor-pointer rounded-[10px] h-[48px] bg-[#08010D] px-8 py-3 text-sm font-medium text-white hover:bg-gray-800 ${props.classes || ''}`} | ||
disabled={props.disabled} | ||
onClick={props.onClick} | ||
> | ||
{props.title} | ||
</button> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./ConnectWallet/ConnectWalletButton"; | ||
export * from "./AccentButton/AccentButton"; | ||
export * from "./PrimaryButton/PrimaryButton"; |
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