Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a way to reset the makeup-next-id so that consistent IDs can be used for testing purposes #1

Open
melquan opened this issue Apr 17, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@melquan
Copy link

melquan commented Apr 17, 2020

When using jest and doing fixture snapshot tests (via @marko/fixture-snapshots), we are seeing new IDs generated by makeup-next-id so the tests fail noting mismatch in IDs.

Example:

-                   id="nid-Ed--0"
+                  id="nid-3rD-0"

It would be nice to allow a way to reset the makeup-next-id so that consistent IDs can be used for testing purposes.

@ianmcburnie
Copy link
Member

Will look into it! Thanks.

@ianmcburnie ianmcburnie self-assigned this Apr 18, 2020
@ianmcburnie
Copy link
Member

@melquan You know that if the element already has an ID, then this module will leave it in place? Or do you mean IDs for elements that are not created by you? Like makeup-active-descendant for example.

@melquan
Copy link
Author

melquan commented Apr 18, 2020

The IDs are not created by us. We have 3 instances of these generated IDs in the fixture snapshot.

First is where have an ebay-infotip in the template:

<ebay-infotip
    pointer="..."
    aria-label="..."
    a11y-close-text="...">
    ...
</ebay-infotip>

HTML generated in the snapshot:

<span>
    <span>
        <span
            class="infotip"
            id="nid-Ed--0"
        >

Second is where we have a div like this:

<div
    key="key"
    class="..."
>

and then call ActiveDescendant.createLinear on it from makeup-active-descendant.

HTML generated in the snapshot:

<div
    class="..."
    id="nid-Ed--1"
>

Third is an li which is inside the div above:

<li
    key:scoped="..."
    class="..."
    role="option"
    aria-selected=""
    tabindex="-1"
    data-testid="..."
    on-click('...')>

HTML generated in the snapshot:

<li
    aria-selected=""
    class="..."
    data-makeup-index="0"
    data-testid="..."
    id="nid-Ed--2"
    role="option"
    tabindex="-1"
>

Let me know if you need more information.

@ianmcburnie
Copy link
Member

Thanks for the info @melquan. I could certainly rejig the APIs around to support this, but before I do that, is there no way to signal those ids as dynamic in the fixture testing framework?

@melquan
Copy link
Author

melquan commented Apr 18, 2020

I'm not familiar enough with the capabilities within the fixture testing framework to know if that's possible. Perhaps @DylanPiercey could provide some insight.

@ianmcburnie ianmcburnie added enhancement New feature or request good first issue Good for newcomers labels Oct 28, 2020
@ianmcburnie ianmcburnie removed their assignment Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants