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] Split tests in describeConformanceV5 to isolate them #24479

Merged
merged 5 commits into from
Jan 18, 2021
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
3 changes: 2 additions & 1 deletion packages/material-ui/src/ButtonBase/TouchRipple.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ describe('<TouchRipple />', () => {
inheritComponent: 'span',
mount,
refInstanceof: Object,
skip: ['componentsProp', 'refForwarding', 'themeComponents'],
muiName: 'MuiTouchRipple',
skip: ['componentsProp', 'refForwarding', 'themeStyleOverrides', 'themeVariants'],
}));

describe('prop: center', () => {
Expand Down
34 changes: 30 additions & 4 deletions test/utils/describeConformanceV5.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ function testComponentsProp(element, getOptions) {
}

/**
* Material-UI theme has a components section that allows specifying default props, overrides and variants
* Material-UI theme has a components section that allows specifying default props.
* Components from @inheritComponent
* @param {React.ReactElement} element
* @param {() => ConformanceOptions} getOptions
*/
function testThemeComponents(element, getOptions) {
function testThemeDefaultProps(element, getOptions) {
const render = createClientRender();

describe('theme: components', () => {
describe('theme: default components', () => {
it("respect theme's defaultProps", () => {
const { muiName, testThemeComponentsDefaultPropName: testProp = 'id' } = getOptions();
const theme = createMuiTheme({
Expand All @@ -56,7 +56,19 @@ function testThemeComponents(element, getOptions) {

expect(container.firstChild).to.have.attribute(testProp, 'testProp');
});
});
}

/**
* Material-UI theme has a components section that allows specifying style overrides.
* Components from @inheritComponent
* @param {React.ReactElement} element
* @param {() => ConformanceOptions} getOptions
*/
function testThemeStyleOverrides(element, getOptions) {
const render = createClientRender();

describe('theme: style overrides', () => {
it("respect theme's styleOverrides custom state", () => {
const { muiName, testStateOverrides } = getOptions();

Expand Down Expand Up @@ -158,7 +170,19 @@ function testThemeComponents(element, getOptions) {
});
}
});
});
}

/**
* Material-UI theme has a components section that allows specifying custom variants.
* Components from @inheritComponent
* @param {React.ReactElement} element
* @param {() => ConformanceOptions} getOptions
*/
function testThemeVariants(element, getOptions) {
const render = createClientRender();

describe('theme: variants', () => {
it("respect theme's variants", () => {
const { muiName, testVariantProps = {} } = getOptions();

Expand Down Expand Up @@ -199,7 +223,9 @@ const fullSuite = {
refForwarding: describeRef,
rootClass: testRootClass,
reactTestRenderer: testReactTestRenderer,
themeComponents: testThemeComponents,
themeDefaultProps: testThemeDefaultProps,
themeStyleOverrides: testThemeStyleOverrides,
themeVariants: testThemeVariants,
};

/**
Expand Down