Skip to content

Commit 57d6cef

Browse files
committed
add test
1 parent b2a45ad commit 57d6cef

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

tests/__snapshots__/index.spec.tsx.snap

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`dialog add rootClassName and rootStyle should render correct 1`] = `
4+
<div
5+
class="rc-dialog-root customize-root-class"
6+
style="font-size: 20px;"
7+
>
8+
<div
9+
class="rc-dialog-mask"
10+
/>
11+
<div
12+
class="rc-dialog-wrap"
13+
style="font-size: 10px;"
14+
tabindex="-1"
15+
>
16+
<div
17+
aria-modal="true"
18+
class="rc-dialog"
19+
role="dialog"
20+
style="width: 600px; height: 903px;"
21+
>
22+
<div
23+
style="outline: none;"
24+
tabindex="0"
25+
>
26+
<div
27+
class="rc-dialog-section"
28+
>
29+
<button
30+
aria-label="Close"
31+
class="rc-dialog-close"
32+
type="button"
33+
>
34+
<span
35+
class="rc-dialog-close-x"
36+
/>
37+
</button>
38+
<div
39+
class="rc-dialog-body"
40+
/>
41+
</div>
42+
</div>
43+
<div
44+
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
45+
tabindex="0"
46+
/>
47+
</div>
48+
</div>
49+
</div>
50+
`;
51+
352
exports[`dialog add rootClassName should render correct 1`] = `
453
<div
554
class="rc-dialog-root customize-root-class"

tests/index.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ describe('dialog', () => {
3636
expect(wrapper.render()).toMatchSnapshot();
3737
});
3838

39-
it('add rootClassName should render correct', () => {
39+
it('add rootClassName and rootStyle should render correct', () => {
4040
const spy = jest.spyOn(console, 'error').mockImplementation(() => {});
4141
const wrapper = mount(
4242
<Dialog
4343
visible
4444
rootClassName="customize-root-class"
45+
rootStyle={{ fontSize: 20 }}
4546
style={{ width: 600 }}
4647
height={903}
4748
wrapStyle={{ fontSize: 10 }}
@@ -56,6 +57,7 @@ describe('dialog', () => {
5657
);
5758
expect(wrapper.find('.customize-root-class').length).toBeTruthy();
5859
expect(wrapper.find('.rc-dialog-wrap').props().style.fontSize).toBe(10);
60+
expect(wrapper.find('.rc-dialog-root').props().style.fontSize).toBe(20);
5961
expect(wrapper.find('.rc-dialog').props().style.height).toEqual(903);
6062
expect(wrapper.find('.rc-dialog').props().style.width).toEqual(600);
6163
});

0 commit comments

Comments
 (0)