File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 mapNativeEventNames ,
2222 containsChildrenSubArray ,
2323 propsOfNode ,
24+ typeOfNode ,
2425} from './Utils' ;
2526import {
2627 debugInsts ,
@@ -485,10 +486,7 @@ export default class ReactWrapper {
485486 * @returns {String|Function }
486487 */
487488 type ( ) {
488- return this . single ( ( n ) => {
489- const node = getNode ( n ) ;
490- return node ? node . type : null ;
491- } ) ;
489+ return this . single ( n => typeOfNode ( getNode ( n ) ) ) ;
492490 }
493491
494492 /**
Original file line number Diff line number Diff line change 77 propFromEvent ,
88 withSetStateAllowed ,
99 propsOfNode ,
10+ typeOfNode ,
1011} from './Utils' ;
1112import {
1213 debugNodes ,
@@ -464,7 +465,7 @@ export default class ShallowWrapper {
464465 * @returns {String|Function }
465466 */
466467 type ( ) {
467- return this . single ( n => n ? n . type : null ) ;
468+ return this . single ( typeOfNode ) ;
468469 }
469470
470471 /**
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ export function propsOfNode(node) {
2020 return ( node && node . props ) || { } ;
2121}
2222
23+ export function typeOfNode ( node ) {
24+ return node ? node . type : null ;
25+ }
26+
2327export function onPrototype ( Component , lifecycle , method ) {
2428 const proto = Component . prototype ;
2529 Object . getOwnPropertyNames ( proto ) . forEach ( ( name ) => {
You can’t perform that action at this time.
0 commit comments