@@ -145,22 +145,32 @@ describeWithShallowAndMount('findAll', mountingMethod => {
145
145
expect ( componentArr . length ) . to . equal ( 1 )
146
146
} )
147
147
148
- it ( 'returns an array of VueWrappers of Vue Components matching componentusing findAllComponents' , ( ) => {
148
+ it ( 'returns an array of VueWrappers of Vue Components matching components using findAllComponents' , ( ) => {
149
149
const wrapper = mountingMethod ( ComponentWithChild )
150
150
const componentArr = wrapper . findAllComponents ( Component )
151
151
expect ( componentArr . length ) . to . equal ( 1 )
152
152
} )
153
153
154
- it ( 'throws an error if findComponent selector is a CSS selector' , ( ) => {
154
+ it ( 'throws an error if findAllComponents selector is a CSS selector' , ( ) => {
155
155
const wrapper = mountingMethod ( Component )
156
156
const message =
157
- '[vue-test-utils]: findAllComponent requires a Vue constructor or valid find object. If you are searching for DOM nodes, use `find` instead'
157
+ '[vue-test-utils]: findAllComponents requires a Vue constructor or valid find object. If you are searching for DOM nodes, use `find` instead'
158
158
const fn = ( ) => wrapper . findAllComponents ( '#foo' )
159
159
expect ( fn )
160
160
. to . throw ( )
161
161
. with . property ( 'message' , message )
162
162
} )
163
163
164
+ it ( 'throws an error if chaining findAllComponents off a DOM element' , ( ) => {
165
+ const wrapper = mountingMethod ( ComponentWithChild )
166
+ const message =
167
+ '[vue-test-utils]: You cannot chain findAllComponents off a DOM element. It can only be used on Vue Components.'
168
+ const fn = ( ) => wrapper . find ( 'span' ) . findAllComponents ( '#foo' )
169
+ expect ( fn )
170
+ . to . throw ( )
171
+ . with . property ( 'message' , message )
172
+ } )
173
+
164
174
it ( 'returns correct number of Vue Wrapper when component has a v-for' , ( ) => {
165
175
const items = [ { id : 1 } , { id : 2 } , { id : 3 } ]
166
176
const wrapper = mountingMethod ( ComponentWithVFor , { propsData : { items } } )
0 commit comments