-
-
Notifications
You must be signed in to change notification settings - Fork 941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: (Container, Input, Navbar) removing get dom node #4036
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@Chriscaracach is attempting to deploy a commit to the rsuite Team on Vercel. A member of the Team first needs to authorize it. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
@@ -13,6 +13,7 @@ describe('Container styles', () => { | |||
<span>Title</span> | |||
</Container> | |||
); | |||
assert.equal(getStyle(getDOMNode(instanceRef.current), 'display'), 'flex'); | |||
const dom = instanceRef.current as Element; | |||
assert.equal(getStyle(dom, 'display'), 'flex'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use expect
instead of assert
as the test assertion to maintain code style consistency.
expect(container.firstChild).to.have.style('display', 'flex');
19c11b0
to
54dbed1
Compare
src/Input/test/InputStylesSpec.tsx
Outdated
|
||
import '../styles/index.less'; | ||
|
||
describe('Input styles', () => { | ||
it('Input should render the correct styles', () => { | ||
const instanceRef = React.createRef<HTMLInputElement>(); | ||
render(<Input ref={instanceRef} />); | ||
const dom = getDOMNode(instanceRef.current); | ||
const dom = instanceRef.current as Element; | ||
inChrome && | ||
assert.equal(getStyle(dom, 'border'), `1px solid ${toRGB('#e5e5ea')}`, 'Input border'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use expect
instead of assert
as the test assertion to maintain code style consistency.
src/Navbar/test/NavbarStylesSpec.tsx
Outdated
@@ -10,7 +10,7 @@ describe('Navbar styles', () => { | |||
it('Should render the correct styles', () => { | |||
const instanceRef = React.createRef<HTMLDivElement>(); | |||
render(<Navbar ref={instanceRef} />); | |||
const dom = getDOMNode(instanceRef.current); | |||
const dom = instanceRef.current as Element; | |||
assert.equal(getStyle(dom, 'backgroundColor'), toRGB('#f7f7fa'), 'NavBar background-color'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use expect
instead of assert
as the test assertion to maintain code style consistency.
54dbed1
to
3c9787b
Compare
Why I am doing this: #3200
What I did: removing the getDOMNode and using the render in @testing-library/react
This update involves 3 component changes: Container, Input, Navbar