Skip to content

Commit

Permalink
[DialogContentText] Test conformance (#15206)
Browse files Browse the repository at this point in the history
Missing from #15135
  • Loading branch information
eps1lon committed Apr 4, 2019
1 parent 496b0ff commit 1dee839
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
@@ -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
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
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

0 comments on commit 1dee839

Please sign in to comment.