Skip to content

Releases: HenrikJoreteg/human-view

Adding getByRole method.

21 Jan 01:07
Compare
Choose a tag to compare

Shortcut for fetching elements by their "role" attribute. This is for convenience and also to encourage the use of the role attribute for grabbing elements from the view.

So inside a view you can now do:

this.list = this.getByRole('people-list');

Using this convention makes it much less likely that designers and JS devs accidentally break each other's code.

Take for example:

<nav class="people" role="people-list"></nav>

It's very clear what that element will be populated with but also, the designer is free to add/change whatever classes they want, or even switch it to <ul> without breaking things.