1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = testRef;
|
11 |
|
12 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
13 |
|
14 | var React = _interopRequireWildcard(require("react"));
|
15 |
|
16 | var _chai = require("chai");
|
17 |
|
18 | function assertDOMNode(node) {
|
19 |
|
20 | (0, _chai.expect)((0, _typeof2.default)(node.nodeName)).to.equal('string');
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | function testRef(element, mount) {
|
33 | var onRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : assertDOMNode;
|
34 | var ref = React.createRef();
|
35 | var wrapper = mount( React.createElement(React.Fragment, null, React.cloneElement(element, {
|
36 | ref: ref
|
37 | })));
|
38 | onRef(ref.current, wrapper);
|
39 | } |
\ | No newline at end of file |