emberjs / emberjs/ember-test-helpers

find/findAll helpers with an element context

Open
#658 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
188
Forks
254
PR merge metrics
No merged PRs in 30d

Description

I often find myself wanting to use the test helpers to query for elements within the context of another element. Like this:

```javascript
const myParentElement = find('.my-parent');

await click(find('.toggle-me', myParentElement));

const text = findAll('.my-child', myParentElement)).map(e => e.textContent);

assert.deepEqual(text, ['one', 'two', 'three']);
```

It's only _slightly annoying_ having to use `querySelectorAll` because it returns a NodeList, whereas the test helpers return an array.

It would be nice to be using a single api rather than two

(Qunit-dom supports this too)

Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.