MetaMask / metamask-design-system

2 stars 1 forks source link

chore: adds tests to design-system-tailwind-preset for colors and index #51

Closed georgewrmarshall closed 1 month ago

georgewrmarshall commented 1 month ago

Description

This PR adds unit tests for the Tailwind preset package to ensure that all CSS color variables used in the preset align with those defined in the @metamask/design-tokens package. Specifically, it verifies:

This change improves the reliability of the Tailwind preset by ensuring consistency with the design tokens.

Related issues

Fixes: https://github.com/MetaMask/metamask-design-system/issues/48

Manual testing steps

  1. Pull this branch.
  2. Run yarn in the root of the metamask-design-system.
  3. Run yarn workspace @metamask/design-system-tailwind-preset jest to confirm that tests pass.
  4. In colors.ts, change a CSS variable to one that doesn't exist in the design-tokens package.
  5. Run yarn workspace @metamask/design-system-tailwind-preset jest to confirm the tests fail.
  6. In node_modules/@metamask/design-tokens/dist/styles.css, add a color token --color-random: #000000.
  7. Save the file.
  8. Run yarn workspace @metamask/design-system-tailwind-preset jest to confirm the tests fail.

Screenshots/Recordings

After

The recording demonstrates tests validating the stylesheet CSS against a preset color object and the Tailwind preset configuration.

colors.test.ts

https://github.com/user-attachments/assets/9aa006b0-4a39-4e00-8174-64acdd88bcf9

index.test.ts

https://github.com/user-attachments/assets/321f274d-03e9-47c3-9cc1-85ad7ab189b0

100% test coverage

Screenshot 2024-10-17 at 4 30 57 PM

Pre-merge author checklist

Pre-merge reviewer checklist