admin管理员组文章数量:1405157
I have a html table with the following data:
id | name
2 | C
1 | B
3 | A
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 paring the columns (tds) ? Thanks.
I have a html table with the following data:
id | name
2 | C
1 | B
3 | A
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 paring the columns (tds) ? Thanks.
Share Improve this question edited Oct 29, 2019 at 16:41 skyboyer 23.8k7 gold badges62 silver badges71 bronze badges asked Oct 29, 2019 at 13:52 AjjjHshAjjjHsh 2532 gold badges6 silver badges13 bronze badges1 Answer
Reset to default 2You 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')
本文标签: javascriptjest test table rows and columnsStack Overflow
版权声明:本文标题:javascript - jest test table rows and columns - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744885825a2630478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论