@@ -17,6 +17,7 @@ import WrapperArray from './wrapper-array'
1717import ErrorWrapper from './error-wrapper'
1818import { throwError , warn } from '../lib/util'
1919import findAll from '../lib/find'
20+ import createWrapper from './create-wrapper'
2021
2122export default class Wrapper implements BaseWrapper {
2223 vnode : VNode ;
@@ -66,7 +67,8 @@ export default class Wrapper implements BaseWrapper {
6667 Object . keys ( this . vm . $style ) . forEach ( ( key ) => {
6768 // $FlowIgnore : Flow thinks vm is a property
6869 moduleIdent = this . vm . $style [ key ]
69- // CSS Modules may be multi-class if they extend others. Extended classes should be already present in $style.
70+ // CSS Modules may be multi-class if they extend others.
71+ // Extended classes should be already present in $style.
7072 moduleIdent = moduleIdent . split ( ' ' ) [ 0 ]
7173 cssModuleIdentifiers [ moduleIdent ] = key
7274 } )
@@ -227,9 +229,7 @@ export default class Wrapper implements BaseWrapper {
227229 }
228230 return new ErrorWrapper ( typeof selector === 'string' ? selector : 'Component' )
229231 }
230- return nodes [ 0 ] instanceof Vue
231- ? new VueWrapper ( nodes [ 0 ] , this . options )
232- : new Wrapper ( nodes [ 0 ] , this . update , this . options )
232+ return createWrapper ( nodes [ 0 ] , this . update , this . options )
233233 }
234234
235235 /**
@@ -238,10 +238,9 @@ export default class Wrapper implements BaseWrapper {
238238 findAll ( selector : Selector ) : WrapperArray {
239239 const selectorType = getSelectorTypeOrThrow ( selector , 'findAll' )
240240 const nodes = findAll ( this . vm , this . vnode , selectorType , selector )
241- const wrappers = nodes [ 0 ] && nodes [ 0 ] instanceof Vue
242- ? nodes . map ( node => new VueWrapper ( node , this . options ) )
243- : nodes . map ( node => new Wrapper ( node , this . update , this . options ) )
244-
241+ const wrappers = nodes . map ( node =>
242+ createWrapper ( node , this . update , this . options )
243+ )
245244 return new WrapperArray ( wrappers )
246245 }
247246
0 commit comments