Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69e5c1e

Browse files
committed
test: one more scryRenderedComponentsWithType case
1 parentf9cc9fb commit69e5c1e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎packages/nerv-test-utils/__tests__/test.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,27 @@ describe('ReactTestUtils', () => {
259259
consthrs=ReactTestUtils.scryRenderedDOMComponentsWithTag(inst,'hr')
260260
expect(hrs.length).toBe(2)
261261
})
262+
263+
it('scryRenderedComponentsWithType should works with multiple instances',()=>{
264+
classButtonextendsReact.Component{
265+
render(){
266+
return<button>{this.props.children}</button>
267+
}
268+
}
269+
270+
functionCounter(){
271+
return(
272+
<div>
273+
<Button>+1</Button>
274+
<span>{1}</span>
275+
<Button>-1</Button>
276+
</div>
277+
)
278+
}
279+
280+
constinst=ReactTestUtils.renderIntoDocument(<Counter/>)
281+
constbtns=ReactTestUtils.scryRenderedComponentsWithType(inst,Button)
282+
283+
expect(btns.length).toBe(2)
284+
})
262285
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp