How to get an array of elements from jqLite object

81 views Asked by At

I'm trying to write a test that checks that I have 3 elements, each with a different value. I have found them in my compiled component using compiled.find('li'), but I am unable to then map because I have a jQLite object instead of a simple array.

How do I get an array of the found elements?

1

There are 1 answers

0
georgeawg On BEST ANSWER

Use Object.assign:

var arr = Object.assign([],jqLiteObj);

Properties that parse as integers will be added to the array. Other properties will be added as named properties of the array object.

For more information, see