I have a html table with the following data:
id | name
I need to test the order of table items. I can get the rows using:
wrapper.findAll('table tr')
But how can I assert the order of rows comparing the columns (tds) ? Thanks.
You can do something like this:
let $rows = wrapper.findAll('tbody > tr').wrappers
let column1 = $rows.map(row => {
return row.
findAll('td')
.at(0)
.text()
})
expect(column1[0]).toBe('text 1')
expect(column1[1]).toBe('text 2')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With