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

[test] Scope the tests to just Material UI components #35219

Merged
merged 24 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 23 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
3 changes: 2 additions & 1 deletion packages/mui-material/src/Alert/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ describe('<Alert />', () => {
muiName: 'MuiAlert',
testVariantProps: { variant: 'standard', color: 'success' },
testDeepOverrides: { slotName: 'message', slotClassName: classes.message },
testLegacyComponentsProp: true,
slots: {
closeButton: {},
closeIcon: {},
},
skip: ['componentsProp'],
skip: ['componentsProp', 'slotPropsCallback'],
}));

describe('prop: square', () => {
Expand Down
9 changes: 8 additions & 1 deletion packages/mui-material/src/Autocomplete/Autocomplete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,20 @@ describe('<Autocomplete />', () => {
testStateOverrides: { prop: 'fullWidth', value: true, styleKey: 'fullWidth' },
refInstanceof: window.HTMLDivElement,
testComponentPropWith: 'div',
testLegacyComponentsProp: true,
slots: {
clearIndicator: { expectedClassName: classes.clearIndicator },
paper: { expectedClassName: classes.paper },
popper: { expectedClassName: classes.popper },
popupIndicator: { expectedClassName: classes.popupIndicator },
},
skip: ['componentProp', 'componentsProp', 'slotsProp', 'reactTestRenderer'],
skip: [
'componentProp',
'componentsProp',
'slotsProp',
'reactTestRenderer',
'slotPropsCallback',
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind adding a comment to explain why this is skipped (for all instances)? // not supported yet should be enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, thanks for asking.

],
}),
);

Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/AvatarGroup/AvatarGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ describe('<AvatarGroup />', () => {
muiName: 'MuiAvatarGroup',
refInstanceof: window.HTMLDivElement,
testVariantProps: { max: 10, spacing: 'small', variant: 'square' },
testLegacyComponentsProp: true,
slots: {
additionalAvatar: { expectedClassName: classes.avatar },
},
skip: ['componentsProp', 'slotsProp'],
skip: ['componentsProp', 'slotsProp', 'slotPropsCallback'],
}),
);

Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Backdrop/Backdrop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('<Backdrop />', () => {
refInstanceof: window.HTMLDivElement,
muiName: 'MuiBackdrop',
testVariantProps: { invisible: true },
testLegacyComponentsProp: true,
slots: {
root: {
expectedClassName: classes.root,
Expand All @@ -25,6 +26,7 @@ describe('<Backdrop />', () => {
'componentsProp',
// react-transition-group issue
'reactTestRenderer',
'slotPropsCallback',
],
}));

Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/FilledInput/FilledInput.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ describe('<FilledInput />', () => {
testDeepOverrides: { slotName: 'input', slotClassName: classes.input },
testVariantProps: { variant: 'contained', fullWidth: true },
testStateOverrides: { prop: 'size', value: 'small', styleKey: 'sizeSmall' },
testLegacyComponentsProp: true,
slots: {
// can't test with DOM element as Input places an ownerState prop on it unconditionally.
root: { expectedClassName: classes.root, testWithElement: null },
input: { expectedClassName: classes.input, testWithElement: null },
},
skip: ['componentProp', 'componentsProp'],
skip: ['componentProp', 'componentsProp', 'slotPropsCallback'],
}));

it('should have the underline class', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ describe('<FormControlLabel />', () => {
render,
muiName: 'MuiFormControlLabel',
testVariantProps: { disabled: true },
testLegacyComponentsProp: true,
refInstanceof: window.HTMLLabelElement,
slots: {
typography: { expectedClassName: classes.label },
},
skip: ['componentProp', 'componentsProp', 'slotsProp'],
skip: ['componentProp', 'componentsProp', 'slotsProp', 'slotPropsCallback'],
}));

describe('prop: label', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/Input/Input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ describe('<Input />', () => {
testDeepOverrides: { slotName: 'input', slotClassName: classes.input },
testVariantProps: { variant: 'contained', fullWidth: true },
testStateOverrides: { prop: 'size', value: 'small', styleKey: 'sizeSmall' },
testLegacyComponentsProp: true,
slots: {
// can't test with DOM element as Input places an ownerState prop on it unconditionally.
root: { expectedClassName: classes.root, testWithElement: null },
input: { expectedClassName: classes.input, testWithElement: null },
},
skip: ['componentProp', 'componentsProp'],
skip: ['componentProp', 'componentsProp', 'slotPropsCallback'],
}));

it('should forward classes to InputBase', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/InputBase/InputBase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ describe('<InputBase />', () => {
refInstanceof: window.HTMLDivElement,
muiName: 'MuiInputBase',
testVariantProps: { size: 'small' },
testLegacyComponentsProp: true,
slots: {
// can't test with DOM element as InputBase places an ownerState prop on it unconditionally.
root: { expectedClassName: classes.root, testWithElement: null },
input: { expectedClassName: classes.input, testWithElement: null },
},
skip: ['componentProp'],
skip: ['componentProp', 'slotPropsCallback'],
}));

it('should render an <input /> inside the div', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/ListItem/ListItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ describe('<ListItem />', () => {
refInstanceof: window.HTMLLIElement,
muiName: 'MuiListItem',
testVariantProps: { dense: true },
testLegacyComponentsProp: true,
slots: {
root: {},
},
skip: ['componentsProp'],
skip: ['componentsProp', 'slotPropsCallback'],
}));

it('should render with gutters classes', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Modal/Modal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('<Modal />', () => {
muiName: 'MuiModal',
refInstanceof: window.HTMLDivElement,
testVariantProps: { hideBackdrop: true },
testLegacyComponentsProp: true,
slots: {
root: { expectedClassName: classes.root },
backdrop: {},
Expand All @@ -42,6 +43,7 @@ describe('<Modal />', () => {
'themeDefaultProps', // portal, can't determine the root
'themeStyleOverrides', // portal, can't determine the root
'reactTestRenderer', // portal https://github.com/facebook/react/issues/11565
'slotPropsCallback',
],
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ describe('<OutlinedInput />', () => {
testDeepOverrides: { slotName: 'input', slotClassName: classes.input },
testVariantProps: { variant: 'contained', fullWidth: true },
testStateOverrides: { prop: 'size', value: 'small', styleKey: 'sizeSmall' },
testLegacyComponentsProp: true,
slots: {
// can't test with DOM element as InputBase places an ownerState prop on it unconditionally.
root: { expectedClassName: classes.root, testWithElement: null },
input: { expectedClassName: classes.input, testWithElement: null },
},
skip: ['componentProp', 'componentsProp'],
skip: ['componentProp', 'componentsProp', 'slotPropsCallback'],
}));

it('should render a NotchedOutline', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('<PaginationItem />', () => {
refInstanceof: window.HTMLButtonElement,
testVariantProps: { variant: 'foo' },
testStateOverrides: { prop: 'variant', value: 'outlined', styleKey: 'outlined' },
testLegacyComponentsProp: true,
slots: {
first: {},
last: {},
Expand All @@ -26,6 +27,7 @@ describe('<PaginationItem />', () => {
// uses non-standard camel-case fields in `components`
'slotsProp',
'slotPropsProp',
'slotPropsCallback',
],
}));

Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Popper/Popper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('<Popper />', () => {
inheritComponent: 'div',
render,
refInstanceof: window.HTMLDivElement,
testLegacyComponentsProp: true,
slots: {
root: {},
},
Expand All @@ -36,6 +37,7 @@ describe('<Popper />', () => {
'themeVariants',
// https://github.com/facebook/react/issues/11565
'reactTestRenderer',
'slotPropsCallback',
],
}));

Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Slider/Slider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('<Slider />', () => {
testDeepOverrides: { slotName: 'thumb', slotClassName: classes.thumb },
testVariantProps: { color: 'primary', orientation: 'vertical', size: 'small' },
testStateOverrides: { prop: 'color', value: 'secondary', styleKey: 'colorSecondary' },
testLegacyComponentsProp: true,
slots: {
root: {
expectedClassName: classes.root,
Expand All @@ -63,6 +64,7 @@ describe('<Slider />', () => {
expectedClassName: classes.markLabel,
},
},
skip: ['slotPropsCallback'],
}),
);

Expand Down
3 changes: 2 additions & 1 deletion packages/mui-material/src/StepLabel/StepLabel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ describe('<StepLabel />', () => {
render,
refInstanceof: window.HTMLSpanElement,
testVariantProps: { error: true },
testLegacyComponentsProp: true,
slots: {
label: { expectedClassName: classes.label },
},
skip: ['componentProp', 'componentsProp', 'slotsProp'],
skip: ['componentProp', 'componentsProp', 'slotsProp', 'slotPropsCallback'],
}));

describe('label content', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-material/src/Tooltip/Tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('<Tooltip />', () => {
refInstanceof: window.HTMLButtonElement,
testRootOverrides: { slotName: 'popper', slotClassName: classes.popper },
testDeepOverrides: { slotName: 'tooltip', slotClassName: classes.tooltip },
testLegacyComponentsProp: true,
slots: {
popper: {
expectedClassName: classes.popper,
Expand All @@ -58,6 +59,7 @@ describe('<Tooltip />', () => {
'themeVariants',
// react-transition-group issue
'reactTestRenderer',
'slotPropsCallback',
],
}),
);
Expand Down
Loading