How to use test helper find(selector, context)


#1

In my template I have a list with two items. I want to query in my test for those two items but I’m unable to do so.

<ul class="mylist">
    <li>First</li>
    <li>Second</li>
</ul>

In my test I’m querying:

var myList = find('.mylist li');

And then I try to get the first element by:

myList[0];

but this doesnt seem to work. This works:

myList.first().text()

Its returning “First” as espected.

What I’m doing wrong?


#2

After spending some time I found one solution

myList.get(0)

will get the object. And to get the text I have to call

myList.get(0).textContent