avoriaz icon indicating copy to clipboard operation
avoriaz copied to clipboard

Make children select work as it should

Open feliupe opened this issue 7 years ago • 1 comments

I have a question:

Sorry if I misunderstood the way it should work. I have the following html:

<div class='Item'>
  <span>Span #1, in the div.
    A
   <div class='Item'>   <span>B</span> </div>
  </span>
</div>

and my test as:

wrapper.find('.Item > span').length == 1 // and  'should' be true but it returns 2

This is not how the css selector should behave?

feliupe avatar Feb 02 '18 13:02 feliupe

This is the correct behavior I believe.

There are two elements that match that selector, the first span tag, and the second span tag. Both are direct descendants of an element with .Item class

eddyerburgh avatar Feb 02 '18 21:02 eddyerburgh