-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work on the tests! I think this PR is moving in a good direction. A few points below:
- Can we split this PR into two? One that tests the current CSS variables and another that adds the automation. I feel like they are two separate concerns.
- I agree that it makes sense to have a
utils
folder insidesrc/
. In the future, we may want to consolidate and move some of the functions fromdocs/
there if they are used in tests or if it makes sense to do so. - In the automation PR, can we move
automation-scripts/brand-colors-css.js
toscripts/brand-colors-css.js
? I know you are following conventions from other PRs, but I think having anautomation-scripts
folder is redundant.
it('should match JSON values', () => { | ||
for (const [colorGroup, shades] of Object.entries(jsonData)) { | ||
for (const [shade, details] of Object.entries(shades)) { | ||
const variableName = `${colorGroup}-${shade}`; | ||
expect(cssVariables[variableName]).toBe(details.value); | ||
} | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import jsonData from '../figma/brandColors.json'; | ||
|
||
describe('CSS Variables', () => { | ||
const cssFilePath = path.join(__dirname, 'generated-brand-colors.css'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we test the current brand color stylesheet here? Additionally, we should add more tests for the light and dark themes. It's fine to do this in separate PRs if that makes more sense. It would also be good to have tests for typography.
const cssFilePath = path.join(__dirname, 'generated-brand-colors.css'); | |
const cssFilePath = path.join(__dirname, 'brand-colors.css'); |
import path from 'path'; | ||
|
||
import { getCssColorVariables } from '../../utils'; | ||
import jsonData from '../figma/brandColors.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we the first version of this PR test the current CSS variables against tokens.json
?
import jsonData from '../figma/brandColors.json'; | |
import jsonData from '../figma/tokens.json'; |
const cssVariables = getCssColorVariables(cssFilePath, 'brand-colors'); | ||
|
||
it('should match JSON values', () => { | ||
for (const [colorGroup, shades] of Object.entries(jsonData)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating to get brand colors from current token json
for (const [colorGroup, shades] of Object.entries(jsonData)) { | |
for (const [colorGroup, shades] of Object.entries( | |
jsonData.global.brandColors, | |
)) { |
Description
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist