Skip to content

Commit

Permalink
test: πŸ’ fixed icon test unit
Browse files Browse the repository at this point in the history
  • Loading branch information
careteenL committed Aug 23, 2020
1 parent dcf8c32 commit d716d28
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/icon/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Icon, IconProps } from "./index";
import { icons } from "../shared/icons";

function IconTest(icon: IconProps["icon"]) {
const wrapper = render(<Icon icon={icon}></Icon>);
const wrapper = render(<Icon data-testid="icon-path" icon={icon}></Icon>);
const path = wrapper.queryByTestId("icon-path");
expect(path).toHaveAttribute("d", icons[icon]);
expect(path.children[0]).toHaveAttribute("d", icons[icon]);
cleanup();
}

Expand All @@ -17,16 +17,16 @@ describe(" test Icon component", () => {
});
});
it("it should render block ", () => {
const wrapper = render(<Icon icon="mobile" block></Icon>);
const wrapper = render(<Icon data-testid="icon-svg" icon="mobile" block></Icon>);
const svg = wrapper.getByTestId("icon-svg");
expect(svg).toHaveStyle("display:block");
});
it("it should render correct color ", () => {
let wrapper = render(<Icon icon="mobile"></Icon>);
let wrapper = render(<Icon data-testid="icon-path" icon="mobile"></Icon>);
let path = wrapper.queryByTestId("icon-path");
expect(path).toHaveAttribute("color", "black");
cleanup();
wrapper = render(<Icon icon="mobile" color="blue"></Icon>);
wrapper = render(<Icon data-testid="icon-path" icon="mobile" color="blue"></Icon>);
path = wrapper.queryByTestId("icon-path");
expect(path).toHaveAttribute("color", "blue");
});
Expand Down

0 comments on commit d716d28

Please sign in to comment.