This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Similar to the `Button` component, we can now do `<TextButton as="a" href="...">...</TextButton>` to render a link. Also, fixes a bug around the font-size of the `TextButton` component. The `size: "s"` prop applied via `.attrs` wasn't being forwarded to the underlined `Heading` component so, instead, we now extend from just `button` and apply the needed font properties directly in the css body.
- Loading branch information
1 parent
19d5e31
commit 0f29e14
Showing
3 changed files
with
47 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { TextButton } from "../src"; | ||
import { render, screen } from "../test_utils"; | ||
|
||
describe("<TextButton />", () => { | ||
it("renders a button by default", () => { | ||
render(<TextButton>Click me</TextButton>); | ||
|
||
expect( | ||
screen.getByText("Click me", { selector: "button" }) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders an anchor element", () => { | ||
const href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; | ||
render( | ||
<TextButton as="a" href={href}> | ||
Link | ||
</TextButton> | ||
); | ||
|
||
expect(screen.getByText("Link").closest("a")).toHaveAttribute("href", href); | ||
}); | ||
}); |
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