1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var BLACK_LIST_PROPS = ['data-reactroot'];
|
14 |
|
15 | var transformSnapshotProps = function transformSnapshotProps(node) {
|
16 | var blackList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : BLACK_LIST_PROPS;
|
17 | var stack = [node];
|
18 |
|
19 | var _loop = function _loop() {
|
20 | var node = stack.pop();
|
21 |
|
22 | if (node.props) {
|
23 | if (node.props.className) {
|
24 | node.props.className = node.props.className.replace(/-/g, '__');
|
25 | }
|
26 |
|
27 | BLACK_LIST_PROPS.forEach(function (prop) {
|
28 | return delete node.props[prop];
|
29 | });
|
30 | }
|
31 |
|
32 | if (Array.isArray(node.children)) {
|
33 | stack.push.apply(stack, node.children);
|
34 | }
|
35 | };
|
36 |
|
37 | while (stack.length) {
|
38 | _loop();
|
39 | }
|
40 |
|
41 | return node;
|
42 | };
|
43 |
|
44 | var DraftTestHelper = {
|
45 | |
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | transformSnapshotProps: transformSnapshotProps
|
58 | };
|
59 | module.exports = DraftTestHelper; |
\ | No newline at end of file |