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.

add support for multiple elements

See original GitHub issue

I extracted https://github.com/kellyselden/ember-text-test-helper from an app without knowing hasText does whitespace collapsing. I would like to ditch my addon, but to reach feature parity, this project would need to support selectors that match multiple elements and “combine”, as well as assert.dom(document.querySelectorAll('div')).

I think @Turbo87 is open to it, but every assertion will need to be updated. For instance hasAttribute will probably turn into a “all have attribute”.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
runspiredcommented, Mar 23, 2022

@Turbo87 how about either:

assert.dom("selector")
  .exists({ count: 2 })
  .at(0) // get the first index and continue chaining from there
  .hasAttr("thing");
  
assert.dom("selector")
  .exists({ count: 2 })
  .each((dom, index) => {
     dom.hasAttr("thing"); // continue asserting with each of the individual things
  })
0reactions
runspiredcommented, Mar 30, 2022

@Turbo87 to be clear I’m not proposing accessors, though that would be a powerful eject button I wouldn’t mind having, I’m proposing the ability for it to return new instances of assert.dom on an individual item of the list found by original selector. This would massively cleanup a lot of dom assertions I’ve seen, and also naturally be bounded to a single level of decomposition since it’s not possible to further select within a selected element ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

add support for multiple elements · Issue #37 - GitHub
I would like to ditch my addon, but to reach feature parity, this project would need to support selectors that match multiple elements...
Read more >
Creating multiple elements at the same time - Support
Via the model browser you can add multiple elements of one specific type at the same time, for example, a number of diagrams,...
Read more >
How to Append Multiple Elements at Once in JavaScript DOM
In today's post, I'll be taking you through 2 of my favourite ways to append multiple child elements to a parent element with...
Read more >
Add Multiple Elements | Enterprise Architect User Guide
Using the Create Multiple Elements dialog in Sparx Systems Enterprise Architect. ... Design > Element > Insert > Insert Multiple New Elements.
Read more >
Append multiple elements at once using append() - YouTube
In this video I'll be showing you how to use the append () method in JavaScript which lets you append multiple nodes to...
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