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

fix(box): css style properties passed as HTML attributes #7110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mihai-albu-sage
Copy link
Contributor

@mihai-albu-sage mihai-albu-sage commented Dec 3, 2024

Proposed behaviour

The height, width, opacity and color are not being passed directly to the StyledBox component but instead are placed in the cssProps object, and then they are used inside the StyledBox. This prevents the props from being applied to the HTML node directly.

Playwright tests that were checking for the attribute being present on the node have been amended since the attribute is no longer present.

after

Current behaviour

The height, width, opacity and color props are passed directly to the StyledBox component which applies them directly to the HTML node.

before

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@DipperTheDan DipperTheDan self-requested a review December 9, 2024 10:54
);

const box = screen.getByTestId("box");
expect(box).toHaveStyle(`width: 100px`);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion(non-blocking): toHaveStyle accepts an object with multiple values, so you could pass these in as one assertion. I'm OK with the way you've done it, though. Feel free to ignore this comment if you prefer your way 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The indicated tests have been refactored.

removed the css properties from being passed directly to the styled component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants