Skip to content

Commit

Permalink
Updated Button
Browse files Browse the repository at this point in the history
  • Loading branch information
frewes committed Jul 21, 2020
1 parent 56b6af9 commit fdff799
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const Wrapper = styled.button`
${shape}
`;

const Button = ({ text, onClick }) => {
return <Wrapper onClick={onClick}>{text}</Wrapper>;
const Button = ({ children, onClick }) => {
return <Wrapper onClick={onClick}>{children}</Wrapper>;
};

export default Button;
6 changes: 3 additions & 3 deletions test/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from "components/Button";

describe("Button", () => {
test("should display text", () => {
const { container } = render(<Button text="We Salute You!" />);
const { container } = render(<Button>We Salute You!</Button>);

getByText(container, "We Salute You!");
});
Expand All @@ -14,7 +14,7 @@ describe("Button", () => {
test("should handle click events", () => {
const onClickMock = jest.fn();
const { container } = render(
<Button text="Click me, maybe?" onClick={onClickMock} />
<Button onClick={onClickMock}>Click me, maybe?</Button>
);
const component = container.firstChild;

Expand All @@ -25,7 +25,7 @@ describe("Button", () => {
});

test("should make text uppercase", () => {
const { container } = render(<Button text="We Salute You!" />);
const { container } = render(<Button>We Salute You!</Button>);
const component = getByText(container, "We Salute You!");

expect(component).toHaveStyleRule("text-transform", "uppercase");
Expand Down

0 comments on commit fdff799

Please sign in to comment.