Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: eslint jest rules #2349

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/eslintJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ module.exports = {
"no-await-in-loop": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"jest/no-identical-title": "error",
"jest/no-standalone-expect": "error",
"jest/no-if": "error",
"jest/consistent-test-it": "warn",
"jest/no-focused-tests": "error",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import BreadcrumbsItem from "../BreadcrumbsItem";
// inaccessible, so we're replacing <Hide> with a dummy component
jest.mock("../../Hide", () => ({ children }) => children);

describe("Breadcrumbs", () => {
describe("#Breadcrumbs", () => {
const dataTest = "test";
const onGoBack = jest.fn();
beforeEach(() => {
Expand All @@ -31,12 +31,14 @@ describe("Breadcrumbs", () => {
expect(screen.getByLabelText("Breadcrumb")).toBeInTheDocument();
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
});

it("ol should contain correct item type", () => {
expect(screen.getByRole("list")).toHaveAttribute(
"itemType",
expect.stringContaining("BreadcrumbList"),
);
});

it("children should contain active and contentKey", () => {
expect(screen.getByRole("listitem")).toHaveAttribute("aria-current", "page");
expect(document.querySelector("meta")).toHaveAttribute("content", "1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ describe("CallOutBanner - actionable", () => {
it("should have tabIndex", () => {
expect(banner.render().prop("tabindex")).toBe("0");
});
banner.simulate("click");
expect(onClick).toHaveBeenCalled();

it("should be clickabel", () => {
banner.simulate("click");
expect(onClick).toHaveBeenCalled();
});
});
2 changes: 0 additions & 2 deletions packages/orbit-components/src/Heading/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ describe("Heading in DIV, type Title5", () => {
);
it("should have text-transform uppercase", () => {
expect(component.render().prop("name")).toBe(as);
});
it("should have text-transform uppercase", () => {
expect(component).toHaveStyleRule("text-transform", "uppercase");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ describe(`InputGroup - Phone number`, () => {
});
it("should contain a select", () => {
expect(select.exists()).toBe(true);
expect(component.render().prop("data-test")).toBe(dataTest);
});
it("should have spaceAFter", () => {
expect(group.prop("spaceAfter")).toBe(spaceAfter);
});
it("should contain a select", () => {
expect(component.render().prop("data-test")).toBe(dataTest);
});
it("should contain a fake div with styling", () => {
expect(component.find("InputGroup__FakeGroup").exists()).toBe(true);
});
Expand Down
24 changes: 12 additions & 12 deletions packages/orbit-components/src/Layout/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export const LAYOUT_SETTINGS = {
columns: "256px 1fr 288px",
},
layoutColumns: {
// prettier-ignore
"0": {
// $FlowIssue
0: {
hideOn: ["smallMobile", "mediumMobile", "largeMobile"],
element: "aside",
},
// prettier-ignore
"1": {
// $FlowIssue
1: {
element: "main",
},
// prettier-ignore
"2": {
// $FlowIssue
2: {
hideOn: ["smallMobile", "mediumMobile", "largeMobile", "tablet", "desktop"],
},
},
Expand All @@ -46,12 +46,12 @@ export const LAYOUT_SETTINGS = {
columnGap: "24px",
},
layoutColumns: {
// prettier-ignore
"0": {
// $FlowIssue
0: {
element: "main",
},
// prettier-ignore
"1": {
// $FlowIssue
1: {
element: "aside",
},
},
Expand All @@ -64,8 +64,8 @@ export const LAYOUT_SETTINGS = {
columnGap: "24px",
},
layoutColumns: {
// prettier-ignore
"0": {
// $FlowIssue
0: {
element: "main",
},
},
Expand Down
4 changes: 0 additions & 4 deletions packages/orbit-components/src/Select/__tests__/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ describe("Select", () => {
});
it("should have data-state", () => {
expect(select.render().prop("data-state")).toBe("ok");
});
it("should have data-state", () => {
expect(select.render().prop("data-recording-ignore")).toBe("true");
});
it("should have name", () => {
Expand All @@ -62,8 +60,6 @@ describe("Select", () => {
});
it("should have placeholder", () => {
expect(select.childAt(0).text()).toBe(placeholder);
});
it("should have placeholder", () => {
expect(select.render().prop("id")).toBe(id);
});
});
Expand Down
Loading