Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 66539ff

Browse files
committed
Use wrapper.debug for snapshot tests
1 parent d921c23 commit 66539ff

File tree

2 files changed

+72
-59
lines changed

2 files changed

+72
-59
lines changed
Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,76 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`ObjectInspector - classnames has the expected class 1`] = `
4-
<ObjectInspector
5-
autoExpandDepth={0}
6-
getObjectProperties={[Function]}
7-
loadObjectProperties={[Function]}
8-
roots={
9-
Array [
10-
Object {
11-
"contents": Object {
12-
"value": 42,
13-
},
14-
"name": "root",
15-
"path": "root",
16-
},
17-
]
18-
}
19-
/>
4+
"<ObjectInspector autoExpandDepth={0} roots={{...}} getObjectProperties={[Function]} loadObjectProperties={[Function]}>
5+
<Tree className=\\"\\" autoExpandAll={true} autoExpandDepth={0} disabledFocus={[undefined]} itemHeight={20} isExpanded={[Function]} focused={{...}} getRoots={[Function]} getParent={[Function]} getChildren={[Function]} getKey={[Function]} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]} renderItem={[Function]}>
6+
<div className=\\"tree \\" onKeyDown={[Function]} onKeyPress={[Function]} onKeyUp={[Function]} onScroll={[Function]} style={{...}}>
7+
<TreeNode index={0} item={{...}} depth={0} renderItem={[Function]} focused={false} expanded={false} hasChildren={false} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]}>
8+
<div className=\\"tree-node div \\" onFocus={[Function]} onClick={[Function]} onBlur={[undefined]} style={{...}}>
9+
<div className=\\"node object-node\\" style={{...}} onClick={{...}} onDoubleClick={{...}}>
10+
<span className=\\"object-label\\" onClick={{...}}>
11+
root
12+
</span>
13+
<span className=\\"object-delimiter\\">
14+
:
15+
</span>
16+
<span className=\\"objectBox objectBox-number\\">
17+
42
18+
</span>
19+
</div>
20+
<button style={{...}} />
21+
</div>
22+
</TreeNode>
23+
</div>
24+
</Tree>
25+
</ObjectInspector>"
2026
`;
2127
2228
exports[`ObjectInspector - classnames has the inline class when inline prop is true 1`] = `
23-
<ObjectInspector
24-
autoExpandDepth={0}
25-
getObjectProperties={[Function]}
26-
inline={true}
27-
loadObjectProperties={[Function]}
28-
roots={
29-
Array [
30-
Object {
31-
"contents": Object {
32-
"value": 42,
33-
},
34-
"name": "root",
35-
"path": "root",
36-
},
37-
]
38-
}
39-
/>
29+
"<ObjectInspector autoExpandDepth={0} roots={{...}} getObjectProperties={[Function]} loadObjectProperties={[Function]} inline={true}>
30+
<Tree className=\\"inline\\" autoExpandAll={true} autoExpandDepth={0} disabledFocus={[undefined]} itemHeight={20} isExpanded={[Function]} focused={{...}} getRoots={[Function]} getParent={[Function]} getChildren={[Function]} getKey={[Function]} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]} renderItem={[Function]}>
31+
<div className=\\"tree inline\\" onKeyDown={[Function]} onKeyPress={[Function]} onKeyUp={[Function]} onScroll={[Function]} style={{...}}>
32+
<TreeNode index={0} item={{...}} depth={0} renderItem={[Function]} focused={false} expanded={false} hasChildren={false} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]}>
33+
<div className=\\"tree-node div \\" onFocus={[Function]} onClick={[Function]} onBlur={[undefined]} style={{...}}>
34+
<div className=\\"node object-node\\" style={{...}} onClick={{...}} onDoubleClick={{...}}>
35+
<span className=\\"object-label\\" onClick={{...}}>
36+
root
37+
</span>
38+
<span className=\\"object-delimiter\\">
39+
:
40+
</span>
41+
<span className=\\"objectBox objectBox-number\\">
42+
42
43+
</span>
44+
</div>
45+
<button style={{...}} />
46+
</div>
47+
</TreeNode>
48+
</div>
49+
</Tree>
50+
</ObjectInspector>"
4051
`;
4152
4253
exports[`ObjectInspector - classnames has the nowrap class when disableWrap prop is true 1`] = `
43-
<ObjectInspector
44-
autoExpandDepth={0}
45-
disableWrap={true}
46-
getObjectProperties={[Function]}
47-
loadObjectProperties={[Function]}
48-
roots={
49-
Array [
50-
Object {
51-
"contents": Object {
52-
"value": 42,
53-
},
54-
"name": "root",
55-
"path": "root",
56-
},
57-
]
58-
}
59-
/>
54+
"<ObjectInspector autoExpandDepth={0} roots={{...}} getObjectProperties={[Function]} loadObjectProperties={[Function]} disableWrap={true}>
55+
<Tree className=\\"nowrap\\" autoExpandAll={true} autoExpandDepth={0} disabledFocus={[undefined]} itemHeight={20} isExpanded={[Function]} focused={{...}} getRoots={[Function]} getParent={[Function]} getChildren={[Function]} getKey={[Function]} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]} renderItem={[Function]}>
56+
<div className=\\"tree nowrap\\" onKeyDown={[Function]} onKeyPress={[Function]} onKeyUp={[Function]} onScroll={[Function]} style={{...}}>
57+
<TreeNode index={0} item={{...}} depth={0} renderItem={[Function]} focused={false} expanded={false} hasChildren={false} onExpand={[Function]} onCollapse={[Function]} onFocus={[Function]}>
58+
<div className=\\"tree-node div \\" onFocus={[Function]} onClick={[Function]} onBlur={[undefined]} style={{...}}>
59+
<div className=\\"node object-node\\" style={{...}} onClick={{...}} onDoubleClick={{...}}>
60+
<span className=\\"object-label\\" onClick={{...}}>
61+
root
62+
</span>
63+
<span className=\\"object-delimiter\\">
64+
:
65+
</span>
66+
<span className=\\"objectBox objectBox-number\\">
67+
42
68+
</span>
69+
</div>
70+
<button style={{...}} />
71+
</div>
72+
</TreeNode>
73+
</div>
74+
</Tree>
75+
</ObjectInspector>"
6076
`;

packages/devtools-reps/src/object-inspector/tests/component/classnames.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,29 @@ function generateDefaults(overrides) {
2323
describe("ObjectInspector - classnames", () => {
2424
it("has the expected class", () => {
2525
const props = generateDefaults();
26-
const oi = ObjectInspector(props);
27-
const wrapper = mount(oi);
26+
const wrapper = mount(ObjectInspector(props));
2827

2928
expect(wrapper.hasClass("tree")).toBeTruthy();
3029
expect(wrapper.hasClass("inline")).toBeFalsy();
3130
expect(wrapper.hasClass("nowrap")).toBeFalsy();
32-
expect(oi).toMatchSnapshot();
31+
expect(wrapper.debug()).toMatchSnapshot();
3332
});
3433

3534
it("has the nowrap class when disableWrap prop is true", () => {
3635
const props = generateDefaults({
3736
disableWrap: true,
3837
});
39-
const oi = ObjectInspector(props);
40-
const wrapper = mount(oi);
38+
const wrapper = mount(ObjectInspector(props));
4139
expect(wrapper.hasClass("nowrap")).toBeTruthy();
42-
expect(oi).toMatchSnapshot();
40+
expect(wrapper.debug()).toMatchSnapshot();
4341
});
4442

4543
it("has the inline class when inline prop is true", () => {
4644
const props = generateDefaults({
4745
inline: true,
4846
});
49-
const oi = ObjectInspector(props);
50-
const wrapper = mount(oi);
47+
const wrapper = mount(ObjectInspector(props));
5148
expect(wrapper.hasClass("inline")).toBeTruthy();
52-
expect(oi).toMatchSnapshot();
49+
expect(wrapper.debug()).toMatchSnapshot();
5350
});
5451
});

0 commit comments

Comments
 (0)