File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
packages/nerv-test-utils/__tests__ Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -259,4 +259,27 @@ describe('ReactTestUtils', () => {
259259 const hrs = ReactTestUtils . scryRenderedDOMComponentsWithTag ( inst , 'hr' )
260260 expect ( hrs . length ) . toBe ( 2 )
261261 } )
262+
263+ it ( 'scryRenderedComponentsWithType should works with multiple instances' , ( ) => {
264+ class Button extends React . Component {
265+ render ( ) {
266+ return < button > { this . props . children } </ button >
267+ }
268+ }
269+
270+ function Counter ( ) {
271+ return (
272+ < div >
273+ < Button > +1</ Button >
274+ < span > { 1 } </ span >
275+ < Button > -1</ Button >
276+ </ div >
277+ )
278+ }
279+
280+ const inst = ReactTestUtils . renderIntoDocument ( < Counter /> )
281+ const btns = ReactTestUtils . scryRenderedComponentsWithType ( inst , Button )
282+
283+ expect ( btns . length ) . toBe ( 2 )
284+ } )
262285} )
You can’t perform that action at this time.
0 commit comments