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

[DialogContentText] Test conformance #15206

Merged
merged 1 commit into from
Apr 4, 2019
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
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '@material-ui/core/test-utils';
import { createMount, createShallow, describeConformance, getClasses } from '../test-utils';
import DialogContentText from './DialogContentText';
import Typography from '../Typography';

describe('<DialogContentText />', () => {
let mount;
let shallow;
let classes;

before(() => {
mount = createMount();
shallow = createShallow({ dive: true });
classes = getClasses(<DialogContentText />);
});

describe('prop: className', () => {
it('should render with the user and root classes', () => {
const wrapper = shallow(<DialogContentText className="woofDialogContentText" />);
assert.strictEqual(wrapper.props().className, 'woofDialogContentText');
assert.strictEqual(wrapper.props().classes.root, classes.root);
});
after(() => {
mount.cleanUp();
});

describeConformance(<DialogContentText>foo</DialogContentText>, () => ({
classes,
inheritComponent: Typography,
mount,
refInstanceof: window.HTMLParagraphElement,
skip: ['componentProp'],
}));

describe('prop: children', () => {
it('should render children', () => {
const children = <p />;
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/test-utils/describeConformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ const fullSuite = {
* @property {string} classes - `classes` of the component provided by `@material-ui/styles`
* @property {string} inheritComponent - The element type that receives spread props.
* @property {function} mount - Should be a return value from createMount
* @property {string[]?} only - If specified only run the tests listed
* @property {(keyof typeof fullSuite)[]?} only - If specified only run the tests listed
* @property {boolean} refInstanceof - `ref` will be an instanceof this constructor.
* @property {string[]?} skip - Skip the specified tests
* @property {keyof typeof fullSuite[]?} skip - Skip the specified tests
* @property {string?} testComponentPropWith - The host component that should be rendered instead.
*/

Expand Down
2 changes: 1 addition & 1 deletion pages/api/dialog-content-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import DialogContentText from '@material-ui/core/DialogContentText';
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The content of the component. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |

The component cannot hold a ref.
The `ref` is forwarded to the root element.

Any other properties supplied will be spread to the root element ([Typography](/api/typography/)).

Expand Down