Skip to content

Commit 4836f6e

Browse files
committed
[test] Test actual ref
1 parent bd6253e commit 4836f6e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/material-ui/src/test-utils/describeConformance.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { assert } from 'chai';
22
import React from 'react';
3+
import testRef from './testRef';
34

45
/**
56
* Glossary
@@ -95,17 +96,13 @@ function testPropsSpread(element, getOptions) {
9596
* @param {React.ReactElement} element
9697
* @param {() => ConformanceOptions} getOptions
9798
*/
98-
function testRef(element, getOptions) {
99+
function describeRef(element, getOptions) {
99100
describe('ref', () => {
100101
it(`attaches the ref`, () => {
101102
// type def in ConformanceOptions
102103
const { mount, refInstanceof } = getOptions();
103104

104-
const ref = React.createRef();
105-
// TODO use `ref` once `WithStylesTest` is removed
106-
mount(React.cloneElement(element, { innerRef: ref }));
107-
108-
assert.instanceOf(ref.current, refInstanceof);
105+
testRef(element, mount, current => assert.instanceOf(current, refInstanceof));
109106
});
110107
});
111108
}
@@ -114,7 +111,7 @@ const fullSuite = {
114111
class: testClassName,
115112
componentProp: testComponentProp,
116113
propsSpread: testPropsSpread,
117-
refForwarding: testRef,
114+
refForwarding: describeRef,
118115
};
119116

120117
/**

0 commit comments

Comments
 (0)