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

data-attributes #11

Closed
Anmo opened this issue May 15, 2023 · 4 comments
Closed

data-attributes #11

Anmo opened this issue May 15, 2023 · 4 comments

Comments

@Anmo
Copy link

Anmo commented May 15, 2023

With the issue #5 (PR #6) we can use any attribute, including data-attribute:

  mount(Button, {
    attributes: {
      'data-this-is-a-data-attribute': true,
    },
  });

But to facilitate, we could have also a dataAttribute parameter:

  mount(Button, {
    dataAttributes: {
      thisIsADataAttribute: true,
    },
  });

To achieve this we could have a simple function like this:

function __pwUpdateDataAttributes(webComponent, dataAttributes = {}) {
  Object.assign(webComponent.dataset, dataAttributes)
}
@sand4rt
Copy link
Owner

sand4rt commented May 18, 2023

Thank you for creating the issue! Could you tell a bit more about why this is useful for testing?

@Anmo
Copy link
Author

Anmo commented May 31, 2023

sorry for the late reply

This is just a nice to have, like I said in the description, with the support for attributes on #6 we can use pass data attributes, but would be easy to use this way, because instead of writing the name of the data attribute with - and therefore the need for using a string, like this:

mount(Button, {
    attributes: {
      'data-attribute-name': true,
    },
  });

you would be able to pass a camel case name (and therefore, without being a string), like this:

mount(Button, {
  dataAttributes: {
    attributeName: true,
  },
});

@sand4rt
Copy link
Owner

sand4rt commented Jun 1, 2023

This is just a nice to have

I don't see how the behaviour of the component is tested with dataAttributes. I'm hesitant to add this because i don't want to deviate from Playwright's API unless there is a good reason.

@sand4rt
Copy link
Owner

sand4rt commented Jul 14, 2023

Closed due to inactivity, feel free to create a new ticket whenever needed

@sand4rt sand4rt closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2023
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

No branches or pull requests

2 participants