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

test(slider): add token theme tests #9665

Open
wants to merge 9 commits into
base: epic/7180-component-tokens
Choose a base branch
from

Conversation

eriklharper
Copy link
Contributor

Related Issue: #7180

Summary

This PR adds token theme tests for calcite-slider.

@eriklharper eriklharper marked this pull request as ready for review June 25, 2024 18:50
@eriklharper eriklharper requested a review from a team as a code owner June 25, 2024 18:50
@eriklharper
Copy link
Contributor Author

Additional notes:

I was unsuccessful getting this extra test to pass, and I'm unsure why:

describe.only("handle focus", () => {
  const tokens: ComponentTestTokens = {
    "--calcite-slider-handle-border-color-hover": {
      shadowSelector: `.${CSS.handle}`,
      targetProp: "boxShadow",
      state: "focus",
    },
  };
  themed(html` <calcite-slider min="0" max="100" value="20" step="10"></calcite-slider> `, tokens);
});

This is an attempt to test that the handle-border-color-hover token is properly applied to the handle as a boxShadow color when the .thumb (parent div of handle) is focused. I tried state: "focus" and state: { focus: { attribute: "class", value: CSS.handle } }.

Copy link
Contributor

@alisonailea alisonailea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we are using the same color to test multiple values its possible to get a false positive on tests. Make sure you are stopping the test just before verification and confirming the tokens are correctly applied. Or check in storybook.

@eriklharper
Copy link
Contributor Author

because we are using the same color to test multiple values its possible to get a false positive on tests. Make sure you are stopping the test just before verification and confirming the tokens are correctly applied. Or check in storybook.

Should we randomize the color being used in each test run?

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.

None yet

2 participants