The answer is to use .querySelectorAll instead. Something like this...
expect(element.querySelector('li').textContent).toContain('foo');
...may become something like this...
expect(element.querySelectorAll('li')[0].textContent).toContain('foo');
...which then affords something different altogether like this...
expect(element.querySelectorAll('li')[1].textContent).toContain('bar');
No comments:
Post a Comment