Skip to content

Commit

Permalink
Merge pull request #27 from dougwperez/main
Browse files Browse the repository at this point in the history
Fix Typo in Cubic Bezier Transformer and Update Tests
  • Loading branch information
lukasoppermann authored Jul 24, 2023
2 parents 749441f + d7bc1af commit f5db64e
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions __tests__/transformer/color-alpha-to-hex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Transformer: colorAlphaToHex', () => {
{ value: '#343' },
{ value: '#343434' },
{ value: '#34343466' }
].map(item => colorAlphaToHex.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorAlphaToHex.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"#334433",
"#343434",
"#34343466"
Expand All @@ -20,7 +20,7 @@ describe('Transformer: colorAlphaToHex', () => {
expect([
{ value: 'rgb(100,200,255)' },
{ value: 'rgba(100,200,255, .4)' }
].map(item => colorAlphaToHex.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorAlphaToHex.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"#64c8ff",
"#64c8ff66",
]);
Expand All @@ -31,7 +31,7 @@ describe('Transformer: colorAlphaToHex', () => {
{ value: '#343434', alpha: .4 },
{ value: '#34343466', alpha: .2 }
// @ts-expect-error: fake token for test causes error
].map(item => colorAlphaToHex.transformer(item))).toStrictEqual([
].map(item => colorAlphaToHex.transformer(item, {}))).toStrictEqual([
"#34343466",
"#34343433"
]);
Expand Down
6 changes: 3 additions & 3 deletions __tests__/transformer/color-alpha-to-rgba.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Transformer: colorToRgba', () => {
{ value: '#343' },
{ value: '#343434' },
{ value: '#34343466' }
].map(item => colorAlphaToRgba.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorAlphaToRgba.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"rgba(51, 68, 51, 1)",
"rgba(52, 52, 52, 1)",
"rgba(52, 52, 52, 0.4)"
Expand All @@ -20,7 +20,7 @@ describe('Transformer: colorToRgba', () => {
{ value: 'rgb(100,200,255)' },
{ value: 'rgba(100,200,255, .4)' },
{ value: 'rgba(100,200,255, 0)' }
].map(item => colorAlphaToRgba.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorAlphaToRgba.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
'rgba(100, 200, 255, 1)',
'rgba(100, 200, 255, 0.4)',
'rgba(100, 200, 255, 0)'
Expand All @@ -33,7 +33,7 @@ describe('Transformer: colorToRgba', () => {
{ value: '#343434cc', alpha: .2 },
{ value: '#343434', alpha: 0 }
// @ts-expect-error: fake token for test causes error
].map(item => colorAlphaToRgba.transformer(item))).toStrictEqual([
].map(item => colorAlphaToRgba.transformer(item, {}))).toStrictEqual([
"rgba(52, 52, 52, 0.4)",
"rgba(52, 52, 52, 0.2)",
"rgba(52, 52, 52, 0)",
Expand Down
4 changes: 2 additions & 2 deletions __tests__/transformer/color-to-hex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Transformer: colorToHex', () => {
{ value: '#343' },
{ value: '#343434' },
{ value: '#34343466' }
].map(item => colorToHex.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorToHex.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"#334433",
"#343434",
"#34343466"
Expand All @@ -19,7 +19,7 @@ describe('Transformer: colorToHex', () => {
expect([
{ value: 'rgb(100,200,255)' },
{ value: 'rgba(100,200,255, .4)' }
].map(item => colorToHex.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorToHex.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"#64c8ff",
"#64c8ff66",
]);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/transformer/color-to-rgb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Transformer: colorToHex', () => {
{ value: '#343' },
{ value: '#343434' },
{ value: '#34343466' }
].map(item => colorToRgba.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorToRgba.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"rgba(51, 68, 51, 1)",
"rgba(52, 52, 52, 1)",
"rgba(52, 52, 52, 0.4)"
Expand All @@ -19,7 +19,7 @@ describe('Transformer: colorToHex', () => {
expect([
{ value: 'rgb(100,200,255)' },
{ value: 'rgba(100,200,255, .4)' }
].map(item => colorToRgba.transformer(item as StyleDictionary.TransformedToken))).toStrictEqual([
].map(item => colorToRgba.transformer(item as StyleDictionary.TransformedToken, {}))).toStrictEqual([
"rgba(100, 200, 255, 1)",
"rgba(100, 200, 255, 0.4)",
]);
Expand Down
6 changes: 3 additions & 3 deletions __tests__/transformer/cubic-bezier-css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe('Transformer: cubicBezierCss', () => {
});

it('transforms `cubicBezier` array tokens', () => {
expect(items.filter(cubicBezierCss.matcher as Matcher).map(item => cubicBezierCss.transformer(item))).toStrictEqual([
"cubic-bezier(0, 0, 0.5, 1);",
"cubic-bezier(0.5, 0, 1, 1);"
expect(items.filter(cubicBezierCss.matcher as Matcher).map(item => cubicBezierCss.transformer(item, {}))).toStrictEqual([
"cubic-bezier(0, 0, 0.5, 1)",
"cubic-bezier(0.5, 0, 1, 1)"
]);
});
})
2 changes: 1 addition & 1 deletion __tests__/transformer/dimension-pixel-to-rem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Transformer: dimensionPixelToRem', () => {
});

it('transforms `dimension` tokens', () => {
expect(items.filter(dimensionPixelToRem.matcher as Matcher).map(item => dimensionPixelToRem.transformer(item))).toStrictEqual([
expect(items.filter(dimensionPixelToRem.matcher as Matcher).map(item => dimensionPixelToRem.transformer(item, {}))).toStrictEqual([
"1.25rem"
]);
})
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/dimension-rem-to-pixel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Transformer: dimensionRemToPixel', () => {
});

it('transforms `dimension` tokens', () => {
expect(items.filter(dimensionRemToPixel.matcher as Matcher).map(item => dimensionRemToPixel.transformer(item))).toStrictEqual([
expect(items.filter(dimensionRemToPixel.matcher as Matcher).map(item => dimensionRemToPixel.transformer(item, {}))).toStrictEqual([
"48px"
]);
})
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/dimension-to-pixelUnitless.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Transformer: dimensionPixelToRem', () => {
}] as StyleDictionary.TransformedToken[];

it('transforms `dimension` tokens', () => {
expect(items.filter(dimensionToPixelUnitless.matcher as Matcher).map(item => dimensionToPixelUnitless.transformer(item))).toStrictEqual([
expect(items.filter(dimensionToPixelUnitless.matcher as Matcher).map(item => dimensionToPixelUnitless.transformer(item, {}))).toStrictEqual([
20,
48,
]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/font-css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Transformer: fontFamily', () => {
});

it('transforms `fontFamily` array tokens', () => {
expect(items.filter(fontCss.matcher as Matcher).map(item => fontCss.transformer(item))).toStrictEqual([
expect(items.filter(fontCss.matcher as Matcher).map(item => fontCss.transformer(item, {}))).toStrictEqual([
"italic 500 16px/22px Helvetica",
"16px Helvetica",
]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/font-family-css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Transformer: fontFamily', () => {
});

it('transforms `fontFamily` array tokens', () => {
expect(items.filter(fontFamilyCss.matcher as Matcher).map(item => fontFamilyCss.transformer(item))).toStrictEqual([
expect(items.filter(fontFamilyCss.matcher as Matcher).map(item => fontFamilyCss.transformer(item, {}))).toStrictEqual([
"helvetica, sans-serif, 'Helvetica Neue'"
]);
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/font-weight-to-number.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Transformer: fontWeight', () => {
});

it('transforms `fontWeight` string to number', () => {
expect(items.filter(fontWeightToNumber.matcher as Matcher).map(item => fontWeightToNumber.transformer(item))).toStrictEqual([
expect(items.filter(fontWeightToNumber.matcher as Matcher).map(item => fontWeightToNumber.transformer(item, {}))).toStrictEqual([
300,
300
]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/name-path-to-dot-notation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Transformer: namePathToDotNotation', () => {
}] as StyleDictionary.TransformedToken[];

it('transforms names to dot notation', () => {
expect(items.map(item => namePathToDotNotation.transformer(item))).toStrictEqual([
expect(items.map(item => namePathToDotNotation.transformer(item, {}))).toStrictEqual([
"base.color.red",
"base.red",
]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transformer/shadow-css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Transformer: shadowCss', () => {
});

it('transforms `shadow` tokens', () => {
expect(items.filter(shadowCss.matcher as Matcher).map(item => shadowCss.transformer(item))).toStrictEqual([
expect(items.filter(shadowCss.matcher as Matcher).map(item => shadowCss.transformer(item, {}))).toStrictEqual([
"0px 0px 0px 3px #00000066"
]);
});
Expand Down
2 changes: 1 addition & 1 deletion src/transformer/cubic-bezier-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export const cubicBezierCss: StyleDictionary.Transform = {
transitive: true,
matcher: (token: StyleDictionary.TransformedToken) => isCubicBezier(token) && Array.isArray(token.value),
transformer: ({ value: [x1, y1, x2, y2] }: { value: TokenCubicBezier }) =>
`cubic-bezier(${x1}, ${y1}, ${x2}, ${y2});`
`cubic-bezier(${x1}, ${y1}, ${x2}, ${y2})`
}

0 comments on commit f5db64e

Please sign in to comment.