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

[ButtonBase] Improve test coverage #16361

Merged
merged 26 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab0e6bd
[ButtonBase] Improve test suite
eps1lon Jun 24, 2019
4b66260
Update testing-library
eps1lon Jun 24, 2019
cd76a35
Remove shallow testing
eps1lon Jun 24, 2019
191dbd0
Reduce acts
eps1lon Jun 25, 2019
d298b45
Use fireEvent.pointerdown
eps1lon Jun 25, 2019
fb03310
Update buttonbase api with action ref
eps1lon Jun 25, 2019
5df58a3
Fix TypeError when mocking touchStart
eps1lon Jun 25, 2019
511f095
Remove unused spy
eps1lon Jun 25, 2019
951545e
Polyfill event.key for manually created events
eps1lon Jun 25, 2019
874b5a6
Skip failing test in chrome 49
eps1lon Jun 25, 2019
a35cb25
FIx failing touchEnd test in edge
eps1lon Jun 25, 2019
efd523b
Add issue link for skipped test
eps1lon Jun 25, 2019
7d56ba6
Debug edge failure
eps1lon Jun 25, 2019
0ff0edf
Dont typecheck js files in docs (yet)
eps1lon Jun 25, 2019
68b1ae9
Fix failing edge test
eps1lon Jun 25, 2019
8c399ad
Fix test setup for chrome 49
eps1lon Jun 25, 2019
d846890
Fix remaining failing edge test
eps1lon Jun 25, 2019
26b42b4
Remove unnecessary fragments
eps1lon Jun 25, 2019
90d28b9
More expect matchers
eps1lon Jun 25, 2019
2e412de
Restore original href + span test
eps1lon Jun 25, 2019
af4e035
Run DragEvent tests in jsdom
eps1lon Jun 25, 2019
03306bb
lenght -> lengthOf
eps1lon Jun 25, 2019
8fd2269
Use proper grammar for expectations
eps1lon Jun 26, 2019
8f36d59
Remove unnecessary named function expressions
eps1lon Jun 26, 2019
0ffa3ed
Re-Introduce centerRipple test
eps1lon Jun 26, 2019
cc69b86
Add actual autoFocus case
eps1lon Jun 26, 2019
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: 4 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "../tsconfig.json",
"include": ["types", "src/pages/**/*"]
"include": ["types", "src/pages/**/*"],
"compilerOptions": {
"allowJs": false
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@
"@emotion/core": "^10.0.0",
"@emotion/styled": "^10.0.0",
"@material-ui/pickers": "^3.1.1",
"@testing-library/react": "^8.0.1",
"@testing-library/react": "^8.0.2",
"@trendmicro/react-interpolate": "^0.5.5",
"@types/autosuggest-highlight": "^3.1.0",
"@types/chai": "^4.1.7",
"@types/chai-dom": "^0.0.7",
"@types/enzyme": "^3.1.4",
"@types/jsdom": "^12.2.3",
"@types/lodash": "^4.14.123",
Expand All @@ -73,6 +74,7 @@
"@types/react-text-mask": "^5.4.2",
"@types/react-virtualized": "^9.21.1",
"@types/react-window": "^1.7.0",
"@types/sinon": "^7.0.13",
"@types/styled-components": "4.1.12",
"@zeit/next-typescript": "^1.1.1",
"address": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/ButtonBase/ButtonBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

export interface ButtonBaseTypeMap {
props: {
action?: (actions: ButtonBaseActions) => void;
action?: React.Ref<ButtonBaseActions>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is passed to useImperativeHandle.

/**
* Prefer `ref` instead.
*/
Expand Down
11 changes: 5 additions & 6 deletions packages/material-ui/src/ButtonBase/ButtonBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ const ButtonBase = React.forwardRef(function ButtonBase(props, ref) {
}
});

/**
* IE 11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
*/
const keydownRef = React.useRef(false);
const handleKeyDown = useEventCallback(event => {
// Check if key is already down to avoid repeats being counted as multiple activations
Expand Down Expand Up @@ -306,14 +309,10 @@ const ButtonBase = React.forwardRef(function ButtonBase(props, ref) {

ButtonBase.propTypes = {
/**
* Callback fired when the component mounts.
* This is useful when you want to trigger an action programmatically.
* A ref for imperative actions.
* It currently only supports `focusVisible()` action.
*
* @param {object} actions This object contains all possible actions
* that can be triggered programmatically.
*/
action: PropTypes.func,
action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
/**
* Use that property to pass a ref callback to the native button component.
* @deprecated Use `ref` instead
Expand Down
Loading