Increase cohesion with ember-test-selectors
See original GitHub issueWould there be interest in either modifying how the hasValue
method works or adding a new one that works well with data-test-* attribute selectors?
A common pattern we use is: assert.dom('[data-test-record-id="1"]').exists()
. This fails with the same message if either the data-test-record-id attr is not present or it is present but has a different value. It would make our tests easier to work with if we could do something like:
assert.dom('[data-test-record-id]').hasValue("1")
And then this could fail with one useful message if data-test-record-id is missing, or a useful diff when it is present but has a value other than “1”.
Overloading the hasValue
method doesn’t seem quite right, so perhaps this is an enhancement request, to add a new method. Maybe hasSelectorValue
?
If there’s interest in adding this I’d be happy to make a PR for it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
I am sorry to ask this, but when #206 is done, that use case is probably covered by
Does that resolve this issue or am I misunderstanding what’s asked here?
I don’t see what the advantage of
assert.dom.selector('[data-some-selector]').hasValue('y');
overassert.dom('[data-some-selector]').hasValue('y');
is