File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -919,7 +919,11 @@ class ReactWrapper {
919919 * @returns {ReactWrapper }
920920 */
921921 at ( index ) {
922- return this . wrap ( this . getNodesInternal ( ) [ index ] ) ;
922+ const nodes = this . getNodesInternal ( ) ;
923+ if ( index < nodes . length ) {
924+ return this . wrap ( nodes [ index ] ) ;
925+ }
926+ return this . wrap ( [ ] ) ;
923927 }
924928
925929 /**
Original file line number Diff line number Diff line change @@ -1116,7 +1116,7 @@ class ShallowWrapper {
11161116 * @returns {ReactElement }
11171117 */
11181118 get ( index ) {
1119- return getAdapter ( this [ OPTIONS ] ) . nodeToElement ( this . getNodesInternal ( ) [ index ] ) ;
1119+ return this . getElements ( ) [ index ] ;
11201120 }
11211121
11221122 /**
@@ -1126,7 +1126,11 @@ class ShallowWrapper {
11261126 * @returns {ShallowWrapper }
11271127 */
11281128 at ( index ) {
1129- return this . wrap ( this . getNodesInternal ( ) [ index ] ) ;
1129+ const nodes = this . getNodesInternal ( ) ;
1130+ if ( index < nodes . length ) {
1131+ return this . wrap ( nodes [ index ] ) ;
1132+ }
1133+ return this . wrap ( [ ] ) ;
11301134 }
11311135
11321136 /**
You can’t perform that action at this time.
0 commit comments