Skip to content

feat: add utilities for generating unique ids - #3993

Merged
vursen merged 2 commits into
masterfrom
feat/unique-id-utils
Jun 8, 2022
Merged

vursen merged 2 commits into
masterfrom
feat/unique-id-utils

Conversation

@vursen

@vursen vursen commented Jun 3, 2022 •

Copy link
Copy Markdown
Contributor

Description

The PR introduces generateUniqueId() and resetUniqueId() utilities that cover common logic related to generating ids in components and mixins.

Note, resetUniqueId() is useful in snapshot tests as it makes the id generation stable and as a result we can get rid of the necessity to ignore a11y related attributes:

- const SNAPSHOT_CONFIG = {
-   ignoreAttributes: ['id', 'aria-describedby', 'aria-labelledby', 'for'],
- };
+ beforeEach(() => {
+   resetUniqueId();
+ }

Type of change

  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@vursen
vursen marked this pull request as ready for review June 3, 2022 14:34
@vursen
vursen requested a review from web-padawan June 3, 2022 14:34
@vursen
vursen force-pushed the feat/unique-id-utils branch from f4ddaa8 to d2e5e33 Compare June 3, 2022 14:38
@vursen vursen changed the title feat: add utils for generating unique ids feat: add utilities for generating unique ids Jun 3, 2022
@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vursen
vursen merged commit 199f62d into master Jun 8, 2022
@vursen
vursen deleted the feat/unique-id-utils branch June 8, 2022 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants