Skip to content

Commit ce58871

Browse files
committed
feat: optimizing semantics
1 parent 92d0e3d commit ce58871

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
globals: {
55
},
66
// setupFilesAfterEnv: ["./setupTests.js"], // enzyme adapter
7-
transformIgnorePatterns: ["/node_modules/", "lib", "dist"],
7+
transformIgnorePatterns: ["/node_modules/", "dist"],
88
testPathIgnorePatterns: ['/node_modules/'],
99
transform: {
1010
"^.+\\.[jt]s?(x)$": "babel-jest"
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
import React from 'react';
1+
import React from 'react';
22
import SlidePane from '../index';
33
import { render } from '@testing-library/react';
44
import '@testing-library/jest-dom/extend-expect';
55

6-
76
describe('test SlidePane ', () => {
87
const expectValues = {
9-
children:(<div>
8+
children: (<div>
109
<h1>success</h1>
1110
</div>),
12-
visible:true,
13-
style:{color:'red',background:'#FF7C12'},
11+
visible: true,
12+
style: { color: 'red', background: '#FF7C12' }
1413
}
1514
test('should render correct', () => {
16-
const {container,getByTestId}=render(<SlidePane
17-
children={expectValues.children}
18-
visible={expectValues.visible}
15+
const { container, getByTestId } = render(<SlidePane
16+
children={expectValues.children}
17+
visible={expectValues.visible}
1918
style={expectValues.style}
20-
/>)
19+
/>)
2120
expect(container.firstChild).toHaveStyle(expectValues.style);
2221
const oDiv = getByTestId('slidepane_container');
2322
expect(oDiv).not.toBeNull();
24-
expect(oDiv).toHaveStyle('display:block');
25-
expect(oDiv.innerHTML).toEqual("<div><h1>success</h1></div>");
23+
expect(oDiv).toBeVisible();
24+
expect(oDiv.innerHTML).toEqual('<div><h1>success</h1></div>');
2625
expect(container).toMatchSnapshot();
2726
})
2827
test('should be invisible', () => {
29-
const {getByTestId}=render(<SlidePane
30-
children={expectValues.children}
31-
visible={false}
32-
/>)
33-
const oDiv = getByTestId('slidepane_container');
34-
expect(oDiv).toHaveStyle('display:none');
35-
})}
36-
)
28+
const { getByTestId } = render(<SlidePane
29+
children={expectValues.children}
30+
visible={false}
31+
/>)
32+
const oDiv = getByTestId('slidepane_container');
33+
expect(oDiv).not.toBeVisible();
34+
})
35+
}
36+
)

0 commit comments

Comments
 (0)