Skip to content

Commit

Permalink
Upgrade a few dev dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
danoc committed Jun 6, 2020
1 parent 2990103 commit aa8e788
Show file tree
Hide file tree
Showing 6 changed files with 1,492 additions and 1,036 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ module.exports = {
"plugin:jest/recommended",
// Prettier must go last so that it can turn off other rules
"prettier",
"prettier/react"
"prettier/react",
],
plugins: ["jest"],
env: {
"jest/globals": true
"jest/globals": true,
},
rules: {
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".tsx"] }]
}
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".tsx"] }],
},
};
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
"@babel/preset-typescript",
],
plugins: []
plugins: [],
};
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"test": "yarn run test:eslint && yarn run test:jest && yarn run test:prettier",
"test:eslint": "eslint . --ignore-path .gitignore --ext .jsx --ext .js --ext .tsx --ext .ts",
"test:jest": "jest --coverage",
"test:jest": "jest",
"test:prettier": "prettier \"**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,html}\" --list-different",
"prepublishOnly": "microbundle --globals react=React",
"format": "prettier \"**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,html}\" --write",
Expand All @@ -27,26 +27,26 @@
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@testing-library/react": "^8.0.1",
"@types/jest": "^24.0.15",
"@types/jest": "^25.2.3",
"@types/react": "^16.8.20",
"@typescript-eslint/parser": "^1.10.2",
"@typescript-eslint/parser": "^3.1.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.0.0",
"babel-jest": "^26.0.1",
"babel-loader": "^8.0.4",
"codecov": "^3.1.0",
"eslint": "^5.10.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^5.0.0",
"eslint": "^7.2.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
"husky": "^2.4.1",
"jest": "^24.0.0",
"husky": "^4.2.5",
"jest": "^26.0.1",
"microbundle": "^0.11.0",
"np": "^5.0.3",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"react": "^16.6.3",
"react-dom": "^16.6.3"
},
Expand Down
31 changes: 19 additions & 12 deletions src/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ afterEach(cleanup);
const charCode = {
enter: 13,
space: 32,
period: 190
period: 190,
};

test("renders into document", () => {
Expand Down Expand Up @@ -123,7 +123,7 @@ describe("events", () => {
);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space
charCode: charCode.space,
});

expect(onClick).toHaveBeenCalledTimes(1);
Expand All @@ -137,7 +137,7 @@ describe("events", () => {
);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space
charCode: charCode.space,
});

expect(onKeyPress).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -182,7 +182,7 @@ describe("events", () => {
);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space
charCode: charCode.space,
});

expect(onClick).toHaveBeenCalledTimes(0);
Expand All @@ -191,7 +191,7 @@ describe("events", () => {

test("does not run `onClick` if a valid key is pressed, the consumer passes in their on `onKeyPress`, and the consumer's `onKeyPress` prevents the event", () => {
const handleClick = jest.fn();
const onKeyPress = jest.fn().mockImplementation(event => {
const onKeyPress = jest.fn().mockImplementation((event) => {
event.preventDefault();
});

Expand Down Expand Up @@ -236,7 +236,7 @@ describe("events", () => {
);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.period
charCode: charCode.period,
});

expect(handleClick).toHaveBeenCalledTimes(0);
Expand Down Expand Up @@ -279,7 +279,7 @@ describe("disabled", () => {
);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space
charCode: charCode.space,
});

expect(handleClick).toHaveBeenCalledTimes(0);
Expand Down Expand Up @@ -341,19 +341,26 @@ describe("`onClick` prop is not provided", () => {
test("does not error when space is pressed", () => {
const { getByText } = render(<ClickableBox>Submit</ClickableBox>);

fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space
});
expect(() => {
fireEvent.keyPress(getByText("Submit"), {
charCode: charCode.space,
});
}).not.toThrow();
});

test("does not error when enter is pressed", () => {
const { getByText } = render(<ClickableBox>Submit</ClickableBox>);

fireEvent.keyPress(getByText("Submit"), { charCode: charCode.enter });
expect(() => {
fireEvent.keyPress(getByText("Submit"), { charCode: charCode.enter });
}).not.toThrow();
});

test("does not error event when clicked on", () => {
const { getByText } = render(<ClickableBox>Submit</ClickableBox>);
fireEvent.click(getByText("Submit"));

expect(() => {
fireEvent.click(getByText("Submit"));
}).not.toThrow();
});
});
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ class ClickableBox extends React.Component<ClickableBoxProps> {
// Announce to screen readers that the `ClickableBox` is disabled.
aria-disabled={disabled ? "true" : undefined}
ref={innerRef}
// eslint-disable-next-line react/jsx-props-no-spreading
{...otherProps}
/>
);
}
}

function forwardRef(props: ClickableBoxProps, ref?: React.Ref<HTMLElement>) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <ClickableBox innerRef={ref} {...props} />;
}

Expand Down

0 comments on commit aa8e788

Please sign in to comment.