vue-cli-plugin-test-attrs
vue-cli-plugin-test-attrs copied to clipboard
Match all the attributes beginning with `data-test-*`
Good morning sir,
Wouldn't it be better to match all the dataset attributes beginning with data-test instead of only matching data-test.
Per example, in the same page I may have data-test-title and data-test-button. Both are different elements that I want to test separately, instead of setting it's value in the attribute because I find this shorter and faster to type.
Example:
<div>
<button data-test-button>My button</button>
<h1 data-test-title>My title</h1>
</div>
In general, I target those elements by using querySelector('[data-test-button]')
What are your opinions about this? Perhaps support both notations? Thank you.
Hm, interesting idea. I'm a bit hesitant since a glob would require to actually loop over all the attributes on each ast element to check wether it matches the glob, and i'm worried that could add up in terms of build time over a bigger project.
So if we add it, it should be optional.