question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Increase cohesion with ember-test-selectors

See original GitHub issue

Would 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:closed
  • Created 5 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lindemcommented, Dec 8, 2018

I am sorry to ask this, but when #206 is done, that use case is probably covered by

assert.dom('[data-test-record-id]').matchesSelector('[data-test-record-id="1"]');

Does that resolve this issue or am I misunderstanding what’s asked here?

0reactions
Turbo87commented, Nov 21, 2018

I don’t see what the advantage of assert.dom.selector('[data-some-selector]').hasValue('y'); over assert.dom('[data-some-selector]').hasValue('y'); is

Read more comments on GitHub >

github_iconTop Results From Across the Web

Increase cohesion with ember-test-selectors #72 - GitHub
Would there be interest in either modifying how the hasValue method works or adding a new one that works well with data-test-* attribute ......
Read more >
Ember Test Selectors | EmberMap
Ember Test Selectors is a small addon that brings some conventions to your testing code. It lets you easily write and select data-test...
Read more >
Getting started with Ember - Learn web development | MDN
Ember works best when it is the entire front end of your application. Increasing cohesion among many team's technology stacks.
Read more >
Introduction - Testing - Ember Guides
Ember Test Selectors is an addon that helps you write tests that are more resilient to DOM changes. You use data-test-* attributes to...
Read more >
Untitled
Turner broadcasting math test, Fred van vleet dunk, ... Advisor meeting ttu, Atomic radius increases periodic table, Julie devine linkedin, Crystal decanter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found