@primer/primitives 7.17.0-rc.61b28bca → 7.17.0-rc.9ef8a8c3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/functional/themes/dark-colorblind.css +14 -14
- package/dist/css/functional/themes/dark-tritanopia.css +14 -14
- package/dist/css/functional/themes/dark.css +14 -14
- package/dist/docs/functional/themes/dark-colorblind.json +7 -7
- package/dist/docs/functional/themes/dark-tritanopia.json +7 -7
- package/dist/docs/functional/themes/dark.json +7 -7
- package/dist/figma/scales/dark.json +5 -5
- package/dist/figma/themes/dark-colorblind.json +20 -20
- package/dist/figma/themes/dark-tritanopia.json +20 -20
- package/dist/figma/themes/dark.json +20 -20
- package/dist/internalCss/dark-colorblind.css +18 -18
- package/dist/internalCss/dark-tritanopia.css +18 -18
- package/dist/internalCss/dark.css +18 -18
- package/dist/styleLint/functional/themes/dark-colorblind.json +7 -7
- package/dist/styleLint/functional/themes/dark-tritanopia.json +7 -7
- package/dist/styleLint/functional/themes/dark.json +7 -7
- package/package.json +1 -1
- package/src/formats/jsonFigma.ts +2 -0
- package/src/platforms/figma.ts +1 -1
- package/src/schemas/collections.ts +2 -0
- package/src/schemas/dimensionToken.ts +1 -1
- package/src/schemas/fontFamilyToken.ts +10 -0
- package/src/schemas/fontWeightToken.ts +10 -0
- package/src/tokens/base/color/dark/dark.json5 +2 -2
- package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
- package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
- package/src/filters/isBorder.test.ts +0 -18
- package/src/filters/isColor.test.ts +0 -22
- package/src/filters/isColorWithAlpha.test.ts +0 -34
- package/src/filters/isColorWithMix.test.ts +0 -108
- package/src/filters/isDeprecated.test.ts +0 -56
- package/src/filters/isDimension.test.ts +0 -22
- package/src/filters/isDuration.test.ts +0 -22
- package/src/filters/isFontFamily.test.ts +0 -22
- package/src/filters/isFontWeight.test.ts +0 -22
- package/src/filters/isFromFile.test.ts +0 -34
- package/src/filters/isShadow.test.ts +0 -18
- package/src/filters/isSource.test.ts +0 -44
- package/src/filters/isTypography.test.ts +0 -18
- package/src/formats/cssCustomMedia.test.ts +0 -11
- package/src/formats/cssThemed.test.ts +0 -87
- package/src/formats/cssWrapMediaQuery.test.ts +0 -170
- package/src/formats/javascriptCommonJs.test.ts +0 -43
- package/src/formats/javascriptEsm.test.ts +0 -41
- package/src/formats/jsonNestedPrefixed.test.ts +0 -73
- package/src/formats/jsonOneDimensional.test.ts +0 -56
- package/src/formats/typescriptExportDefinition.test.ts +0 -178
- package/src/formats/utilities/jsonToFlat.test.ts +0 -47
- package/src/formats/utilities/jsonToNestedValue.test.ts +0 -39
- package/src/formats/utilities/prefixTokens.test.ts +0 -38
- package/src/parsers/w3cJsonParser.test.ts +0 -35
- package/src/schemas/alphaValueSchema.test.ts +0 -24
- package/src/schemas/baseTokenSchema.test.ts +0 -17
- package/src/schemas/borderTokenSchema.test.ts +0 -53
- package/src/schemas/collectionSchema.test.ts +0 -58
- package/src/schemas/colorHexValueSchema.test.ts +0 -26
- package/src/schemas/colorTokenSchema.test.ts +0 -27
- package/src/schemas/dimensionTokenSchema.test.ts +0 -28
- package/src/schemas/dimensionValueSchema.test.ts +0 -21
- package/src/schemas/durationTokenSchema.test.ts +0 -58
- package/src/schemas/durationValueSchema.test.ts +0 -25
- package/src/schemas/fontFamilyTokenSchema.test.ts +0 -82
- package/src/schemas/fontWeightTokenSchema.test.ts +0 -88
- package/src/schemas/fontWeightValue.test.ts +0 -17
- package/src/schemas/numberTokenSchema.test.ts +0 -82
- package/src/schemas/referenceValueSchema.test.ts +0 -20
- package/src/schemas/schema.test.ts +0 -33
- package/src/schemas/scopeTokenSchema.test.ts +0 -29
- package/src/schemas/shadowTokenSchema.test.ts +0 -163
- package/src/schemas/stringTokenSchema.test.ts +0 -81
- package/src/schemas/tokenNameSchema.test.ts +0 -33
- package/src/schemas/typographyTokenSchema.test.ts +0 -58
- package/src/schemas/validTokenTypeSchema.test.ts +0 -32
- package/src/schemas/viewportRangeTokenSchema.test.ts +0 -59
- package/src/transformers/borderToCss.test.ts +0 -58
- package/src/transformers/colorToHex.test.ts +0 -27
- package/src/transformers/colorToHexAlpha.test.ts +0 -30
- package/src/transformers/colorToHexMix.test.ts +0 -83
- package/src/transformers/colorToRgbAlpha.test.ts +0 -33
- package/src/transformers/colorToRgbaFloat.test.ts +0 -168
- package/src/transformers/dimensionToPixelUnitless.test.ts +0 -93
- package/src/transformers/dimensionToRem.test.ts +0 -81
- package/src/transformers/durationToCss.test.ts +0 -56
- package/src/transformers/fontFamilyToCss.test.ts +0 -71
- package/src/transformers/fontWeightToNumbers.test.ts +0 -117
- package/src/transformers/jsonDeprecated.test.ts +0 -31
- package/src/transformers/namePathToCamelCase.test.ts +0 -74
- package/src/transformers/namePathToDotNotation.test.ts +0 -74
- package/src/transformers/namePathToFigma.test.ts +0 -74
- package/src/transformers/namePathToKebabCase.test.ts +0 -74
- package/src/transformers/namePathToSlashNotation.test.ts +0 -74
- package/src/transformers/shadowToCss.test.ts +0 -175
- package/src/transformers/typographyToCss.test.ts +0 -164
- package/src/transformers/utilities/alpha.test.ts +0 -28
- package/src/transformers/utilities/checkRequiredTokenProperties.test.ts +0 -28
- package/src/transformers/utilities/getTokenValue.test.ts +0 -18
- package/src/transformers/utilities/hexToRgbaFloat.test.ts +0 -66
- package/src/transformers/utilities/invalidTokenError.test.ts +0 -21
- package/src/transformers/utilities/isRgbaFloat.test.ts +0 -20
- package/src/transformers/utilities/rgbaFloatToHex.test.ts +0 -16
- package/src/utilities/getFlag.test.ts +0 -31
- package/src/utilities/joinFriendly.test.ts +0 -15
- package/src/utilities/toCamelCase.test.ts +0 -27
- package/src/utilities/treeWalker.test.ts +0 -51
- package/src/utilities/upperCaseFirstCharacter.test.ts +0 -19
- package/tokens-next-private/css/base/size/size.css +0 -19
- package/tokens-next-private/css/base/typography/typography.css +0 -6
- package/tokens-next-private/css/functional/motion/motion.css +0 -5
- package/tokens-next-private/css/functional/size/border.css +0 -14
- package/tokens-next-private/css/functional/size/breakpoints.css +0 -8
- package/tokens-next-private/css/functional/size/size-coarse.css +0 -7
- package/tokens-next-private/css/functional/size/size-fine.css +0 -7
- package/tokens-next-private/css/functional/size/size.css +0 -74
- package/tokens-next-private/css/functional/size/viewport.css +0 -6
- package/tokens-next-private/css/functional/themes/dark-colorblind.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-dimmed.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-high-contrast.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark-tritanopia.css +0 -1078
- package/tokens-next-private/css/functional/themes/dark.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-colorblind.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-high-contrast.css +0 -1078
- package/tokens-next-private/css/functional/themes/light-tritanopia.css +0 -1078
- package/tokens-next-private/css/functional/themes/light.css +0 -1078
- package/tokens-next-private/css/functional/typography/typography.css +0 -47
- package/tokens-next-private/docs/base/size/size.json +0 -427
- package/tokens-next-private/docs/base/typography/typography.json +0 -54
- package/tokens-next-private/docs/functional/motion/motion.json +0 -47
- package/tokens-next-private/docs/functional/size/border.json +0 -234
- package/tokens-next-private/docs/functional/size/breakpoints.json +0 -152
- package/tokens-next-private/docs/functional/size/size-coarse.json +0 -41
- package/tokens-next-private/docs/functional/size/size-fine.json +0 -41
- package/tokens-next-private/docs/functional/size/size.json +0 -1838
- package/tokens-next-private/docs/functional/size/viewport.json +0 -80
- package/tokens-next-private/docs/functional/themes/dark-colorblind.json +0 -16155
- package/tokens-next-private/docs/functional/themes/dark-dimmed.json +0 -16159
- package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +0 -16175
- package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +0 -16161
- package/tokens-next-private/docs/functional/themes/dark.json +0 -16159
- package/tokens-next-private/docs/functional/themes/light-colorblind.json +0 -16123
- package/tokens-next-private/docs/functional/themes/light-high-contrast.json +0 -16125
- package/tokens-next-private/docs/functional/themes/light-tritanopia.json +0 -16115
- package/tokens-next-private/docs/functional/themes/light.json +0 -16113
- package/tokens-next-private/docs/functional/typography/typography.json +0 -663
- package/tokens-next-private/fallbacks/base/size/size.json +0 -19
- package/tokens-next-private/fallbacks/base/typography/typography.json +0 -6
- package/tokens-next-private/fallbacks/color-fallbacks.json +0 -260
- package/tokens-next-private/fallbacks/functional/motion/motion.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/border.json +0 -14
- package/tokens-next-private/fallbacks/functional/size/breakpoints.json +0 -8
- package/tokens-next-private/fallbacks/functional/size/size-coarse.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/size-fine.json +0 -5
- package/tokens-next-private/fallbacks/functional/size/size.json +0 -74
- package/tokens-next-private/fallbacks/functional/size/viewport.json +0 -8
- package/tokens-next-private/fallbacks/functional/typography/typography.json +0 -47
- package/tokens-next-private/internalCss/dark-colorblind.css +0 -1648
- package/tokens-next-private/internalCss/dark-dimmed.css +0 -1648
- package/tokens-next-private/internalCss/dark-high-contrast.css +0 -1648
- package/tokens-next-private/internalCss/dark-tritanopia.css +0 -1648
- package/tokens-next-private/internalCss/dark.css +0 -1648
- package/tokens-next-private/internalCss/light-colorblind.css +0 -1648
- package/tokens-next-private/internalCss/light-high-contrast.css +0 -1648
- package/tokens-next-private/internalCss/light-tritanopia.css +0 -1648
- package/tokens-next-private/internalCss/light.css +0 -1648
- package/tokens-next-private/removed/color.json +0 -421
- package/tokens-next-private/styleLint/base/size/size.json +0 -427
- package/tokens-next-private/styleLint/base/typography/typography.json +0 -54
- package/tokens-next-private/styleLint/functional/motion/motion.json +0 -47
- package/tokens-next-private/styleLint/functional/size/border.json +0 -234
- package/tokens-next-private/styleLint/functional/size/breakpoints.json +0 -152
- package/tokens-next-private/styleLint/functional/size/size-coarse.json +0 -41
- package/tokens-next-private/styleLint/functional/size/size-fine.json +0 -41
- package/tokens-next-private/styleLint/functional/size/size.json +0 -1838
- package/tokens-next-private/styleLint/functional/size/viewport.json +0 -80
- package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +0 -16155
- package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +0 -16159
- package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +0 -16175
- package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +0 -16161
- package/tokens-next-private/styleLint/functional/themes/dark.json +0 -16159
- package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +0 -16123
- package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +0 -16125
- package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +0 -16115
- package/tokens-next-private/styleLint/functional/themes/light.json +0 -16113
- package/tokens-next-private/styleLint/functional/typography/typography.json +0 -663
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isColorWithMix} from './isColorWithMix'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isColorWithMix', () => {
|
|
5
|
-
it('returns true if $type property is `color` and valid `mix` property exists', () => {
|
|
6
|
-
expect(isColorWithMix(getMockToken({$type: 'color', mix: {color: '#000', weight: 0.5}}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `color`', () => {
|
|
10
|
-
expect(isColorWithMix(getMockToken({$type: 'pumpkin', mix: {color: '#000', weight: 0.5}}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is missing', () => {
|
|
14
|
-
expect(isColorWithMix(getMockToken({value: '#000'}))).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if $type property is missing', () => {
|
|
18
|
-
expect(isColorWithMix(getMockToken({value: '#000', mix: null}))).toStrictEqual(false)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('returns false if $type `color` but mix is missing', () => {
|
|
22
|
-
expect(isColorWithMix(getMockToken({$type: 'color'}))).toStrictEqual(false)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('throws error if $type `color` but mix is invalid', () => {
|
|
26
|
-
expect(() => isColorWithMix(getMockToken({$type: 'color', mix: true}))).toThrow()
|
|
27
|
-
expect(() => isColorWithMix(getMockToken({$type: 'color', mix: '#000'}))).toThrow()
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('throws error if $type `color` but mix has invalid properties', () => {
|
|
31
|
-
// missing weight
|
|
32
|
-
expect(() =>
|
|
33
|
-
isColorWithMix(
|
|
34
|
-
getMockToken({
|
|
35
|
-
$type: 'color',
|
|
36
|
-
mix: {
|
|
37
|
-
color: '#000',
|
|
38
|
-
},
|
|
39
|
-
}),
|
|
40
|
-
),
|
|
41
|
-
).toThrow()
|
|
42
|
-
// missing color
|
|
43
|
-
expect(() =>
|
|
44
|
-
isColorWithMix(
|
|
45
|
-
getMockToken({
|
|
46
|
-
$type: 'color',
|
|
47
|
-
mix: {
|
|
48
|
-
weight: 0.5,
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
),
|
|
52
|
-
).toThrow()
|
|
53
|
-
// color is number
|
|
54
|
-
expect(() =>
|
|
55
|
-
isColorWithMix(
|
|
56
|
-
getMockToken({
|
|
57
|
-
$type: 'color',
|
|
58
|
-
mix: {
|
|
59
|
-
color: 1,
|
|
60
|
-
weight: 0.5,
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
).toThrow()
|
|
65
|
-
// color is undefined
|
|
66
|
-
expect(() =>
|
|
67
|
-
isColorWithMix(
|
|
68
|
-
getMockToken({
|
|
69
|
-
$type: 'color',
|
|
70
|
-
mix: {
|
|
71
|
-
color: undefined,
|
|
72
|
-
weight: 0.5,
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
),
|
|
76
|
-
).toThrow()
|
|
77
|
-
// weight is undefined
|
|
78
|
-
expect(() =>
|
|
79
|
-
isColorWithMix(
|
|
80
|
-
getMockToken({
|
|
81
|
-
$type: 'color',
|
|
82
|
-
mix: {
|
|
83
|
-
color: '#000',
|
|
84
|
-
weight: undefined,
|
|
85
|
-
},
|
|
86
|
-
}),
|
|
87
|
-
),
|
|
88
|
-
).toThrow()
|
|
89
|
-
// weight is a string
|
|
90
|
-
expect(() =>
|
|
91
|
-
isColorWithMix(
|
|
92
|
-
getMockToken({
|
|
93
|
-
$type: 'color',
|
|
94
|
-
mix: {
|
|
95
|
-
color: '#000',
|
|
96
|
-
weight: '0.7',
|
|
97
|
-
},
|
|
98
|
-
}),
|
|
99
|
-
),
|
|
100
|
-
).toThrow()
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it('returns false if $type is falsy ', () => {
|
|
104
|
-
expect(isColorWithMix(getMockToken({$type: undefined, mix: {color: '#000', weight: 0.5}}))).toStrictEqual(false)
|
|
105
|
-
expect(isColorWithMix(getMockToken({$type: false, mix: {color: '#000', weight: 0.5}}))).toStrictEqual(false)
|
|
106
|
-
expect(isColorWithMix(getMockToken({$type: null, mix: {color: '#000', weight: 0.5}}))).toStrictEqual(false)
|
|
107
|
-
})
|
|
108
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isDeprecated} from './isDeprecated'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isDeprecated', () => {
|
|
5
|
-
it('Returns true if depreacted property is true', () => {
|
|
6
|
-
expect(isDeprecated(getMockToken({deprecated: true}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('Returns true if depreacted property is a string', () => {
|
|
10
|
-
expect(isDeprecated(getMockToken({deprecated: 'pumpkin'}))).toStrictEqual(true)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('Returns false if deprecated is falsy', () => {
|
|
14
|
-
expect(isDeprecated(getMockToken({deprecated: false}))).toStrictEqual(false)
|
|
15
|
-
expect(isDeprecated(getMockToken({deprecated: null}))).toStrictEqual(false)
|
|
16
|
-
expect(isDeprecated(getMockToken({deprecated: undefined}))).toStrictEqual(false)
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('Returns false if no deprecated property exists', () => {
|
|
20
|
-
expect(isDeprecated(getMockToken({value: 'pumpkin'}))).toStrictEqual(false)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const inputArray = [
|
|
24
|
-
getMockToken({
|
|
25
|
-
deprecated: true,
|
|
26
|
-
}),
|
|
27
|
-
getMockToken({
|
|
28
|
-
deprecated: '{scale.yellow}',
|
|
29
|
-
}),
|
|
30
|
-
getMockToken({
|
|
31
|
-
deprecated: null,
|
|
32
|
-
}),
|
|
33
|
-
getMockToken({
|
|
34
|
-
deprecated: false,
|
|
35
|
-
}),
|
|
36
|
-
getMockToken({
|
|
37
|
-
deprecated: undefined,
|
|
38
|
-
}),
|
|
39
|
-
getMockToken({
|
|
40
|
-
value: 'pumpkin',
|
|
41
|
-
}),
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
const expectedOutput = [
|
|
45
|
-
getMockToken({
|
|
46
|
-
deprecated: true,
|
|
47
|
-
}),
|
|
48
|
-
getMockToken({
|
|
49
|
-
deprecated: '{scale.yellow}',
|
|
50
|
-
}),
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
it('Usage as a filter function', () => {
|
|
54
|
-
expect(inputArray.filter(isDeprecated)).toStrictEqual(expectedOutput)
|
|
55
|
-
})
|
|
56
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isDimension} from './isDimension'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isDimension', () => {
|
|
5
|
-
it('returns true if $type property is `dimension`', () => {
|
|
6
|
-
expect(isDimension(getMockToken({$type: 'dimension'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `dimension`', () => {
|
|
10
|
-
expect(isDimension(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is missing', () => {
|
|
14
|
-
expect(isDimension(getMockToken({alpha: 0.4}))).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if $type property is falsy', () => {
|
|
18
|
-
expect(isDimension(getMockToken({$type: false}))).toStrictEqual(false)
|
|
19
|
-
expect(isDimension(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
20
|
-
expect(isDimension(getMockToken({$type: null}))).toStrictEqual(false)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isDuration} from './isDuration'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isDuration', () => {
|
|
5
|
-
it('returns true if $type property is `duration`', () => {
|
|
6
|
-
expect(isDuration(getMockToken({$type: 'duration'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `duration`', () => {
|
|
10
|
-
expect(isDuration(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is missing', () => {
|
|
14
|
-
expect(isDuration(getMockToken({value: '1000ms'}))).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if $type property is falsy', () => {
|
|
18
|
-
expect(isDuration(getMockToken({$type: false}))).toStrictEqual(false)
|
|
19
|
-
expect(isDuration(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
20
|
-
expect(isDuration(getMockToken({$type: null}))).toStrictEqual(false)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isFontFamily} from './isFontFamily'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isFontFamily', () => {
|
|
5
|
-
it('returns true if $type property is `fontFamily`', () => {
|
|
6
|
-
expect(isFontFamily(getMockToken({$type: 'fontFamily'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `fontFamily`', () => {
|
|
10
|
-
expect(isFontFamily(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is missing', () => {
|
|
14
|
-
expect(isFontFamily(getMockToken({alpha: 0.4}))).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if $type property is falsy', () => {
|
|
18
|
-
expect(isFontFamily(getMockToken({$type: false}))).toStrictEqual(false)
|
|
19
|
-
expect(isFontFamily(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
20
|
-
expect(isFontFamily(getMockToken({$type: null}))).toStrictEqual(false)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isFontWeight} from './isFontWeight'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isFontWeight', () => {
|
|
5
|
-
it('returns true if $type property is `fontWeight`', () => {
|
|
6
|
-
expect(isFontWeight(getMockToken({$type: 'fontWeight'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `fontWeight`', () => {
|
|
10
|
-
expect(isFontWeight(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is missing', () => {
|
|
14
|
-
expect(isFontWeight(getMockToken({alpha: 0.4}))).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if $type property is falsy', () => {
|
|
18
|
-
expect(isFontWeight(getMockToken({$type: false}))).toStrictEqual(false)
|
|
19
|
-
expect(isFontWeight(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
20
|
-
expect(isFontWeight(getMockToken({$type: null}))).toStrictEqual(false)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isFromFile} from './isFromFile'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isFromFile', () => {
|
|
5
|
-
it('returns true if token.filePath is in provided array of file paths', () => {
|
|
6
|
-
expect(isFromFile(getMockToken({filePath: 'src/tokens.json'}), ['src/tokens.json'])).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if token.filePath is NOT in provided array of file paths', () => {
|
|
10
|
-
expect(isFromFile(getMockToken({filePath: 'src/notTokens.json'}), ['src/tokens.json'])).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if token.filePath is undefined', () => {
|
|
14
|
-
expect(isFromFile(getMockToken({filePath: undefined}), ['src/tokens.json'])).toStrictEqual(false)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('returns false if array of file paths is empty', () => {
|
|
18
|
-
expect(isFromFile(getMockToken({filePath: 'src/tokens.json'}), [])).toStrictEqual(false)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('returns false if token.filePath is undefined and array is empty', () => {
|
|
22
|
-
expect(isFromFile(getMockToken({filePath: undefined}), [])).toStrictEqual(false)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('returns false if file path array is undefined', () => {
|
|
26
|
-
// @ts-expect-error: path is missing
|
|
27
|
-
expect(isFromFile(getMockToken({path: 'src/tokens.json'}))).toStrictEqual(false)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('returns false if token.filePath & file path array is undefined', () => {
|
|
31
|
-
// @ts-expect-error: path is missing
|
|
32
|
-
expect(isFromFile(getMockToken({filePath: undefined}))).toStrictEqual(false)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isShadow} from './isShadow'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isShadow', () => {
|
|
5
|
-
it('returns true if $type property is `shadow`', () => {
|
|
6
|
-
expect(isShadow(getMockToken({$type: 'shadow'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `shadow`', () => {
|
|
10
|
-
expect(isShadow(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is falsy', () => {
|
|
14
|
-
expect(isShadow(getMockToken({$type: false}))).toStrictEqual(false)
|
|
15
|
-
expect(isShadow(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
16
|
-
expect(isShadow(getMockToken({$type: null}))).toStrictEqual(false)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type StyleDictionary from 'style-dictionary'
|
|
2
|
-
import {getMockToken} from '../test-utilities'
|
|
3
|
-
import {isSource} from './isSource'
|
|
4
|
-
|
|
5
|
-
describe('Filter: isSource', () => {
|
|
6
|
-
it('Returns true if isSource property is true', () => {
|
|
7
|
-
expect(isSource(getMockToken({isSource: true}))).toStrictEqual(true)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('Returns false if isSource property is falsy value', () => {
|
|
11
|
-
expect(isSource(getMockToken({isSource: false}))).toStrictEqual(false)
|
|
12
|
-
expect(isSource(getMockToken({isSource: null}))).toStrictEqual(false)
|
|
13
|
-
expect(isSource(getMockToken({isSource: undefined}))).toStrictEqual(false)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('Returns false if isSource property is truthy non-boolean value', () => {
|
|
17
|
-
expect(isSource(getMockToken({isSource: 'pumpkin'}))).toStrictEqual(false)
|
|
18
|
-
expect(isSource(getMockToken({isSource: 1}))).toStrictEqual(false)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('Returns false if no isSource property exists', () => {
|
|
22
|
-
expect(isSource({value: 'pumpkin'} as StyleDictionary.TransformedToken)).toStrictEqual(false)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('Usage as a filter function', () => {
|
|
26
|
-
const inputArray = [
|
|
27
|
-
getMockToken({
|
|
28
|
-
value: 'red is source',
|
|
29
|
-
isSource: true,
|
|
30
|
-
}),
|
|
31
|
-
getMockToken({
|
|
32
|
-
value: 'blue is not source',
|
|
33
|
-
isSource: false,
|
|
34
|
-
}),
|
|
35
|
-
{
|
|
36
|
-
value: 'yellow is not source',
|
|
37
|
-
},
|
|
38
|
-
] as StyleDictionary.TransformedToken[]
|
|
39
|
-
|
|
40
|
-
const expectedOutput = inputArray.filter(item => item.isSource === true)
|
|
41
|
-
|
|
42
|
-
expect(inputArray.filter(isSource)).toStrictEqual(expectedOutput)
|
|
43
|
-
})
|
|
44
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../test-utilities'
|
|
2
|
-
import {isTypography} from './isTypography'
|
|
3
|
-
|
|
4
|
-
describe('Filter: isTypography', () => {
|
|
5
|
-
it('returns true if $type property is `typography`', () => {
|
|
6
|
-
expect(isTypography(getMockToken({$type: 'typography'}))).toStrictEqual(true)
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
it('returns false if $type property is not `typography`', () => {
|
|
10
|
-
expect(isTypography(getMockToken({$type: 'pumpkin'}))).toStrictEqual(false)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('returns false if $type property is falsy', () => {
|
|
14
|
-
expect(isTypography(getMockToken({$type: false}))).toStrictEqual(false)
|
|
15
|
-
expect(isTypography(getMockToken({$type: undefined}))).toStrictEqual(false)
|
|
16
|
-
expect(isTypography(getMockToken({$type: null}))).toStrictEqual(false)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {cssCustomMedia} from './cssCustomMedia'
|
|
2
|
-
import {getMockFormatterArguments} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: tokens to custom-media', () => {
|
|
6
|
-
it('Formats tokens with custom media', () => {
|
|
7
|
-
const input = getMockFormatterArguments()
|
|
8
|
-
const expectedOutput = format(`@custom-media --red transformedValue;`, {parser: 'css', printWidth: 500})
|
|
9
|
-
expect(cssCustomMedia(input)).toStrictEqual(expectedOutput)
|
|
10
|
-
})
|
|
11
|
-
})
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import {cssThemed} from './cssThemed'
|
|
2
|
-
import {getMockFormatterArguments} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: Css Themed', () => {
|
|
6
|
-
it('Formats tokens', () => {
|
|
7
|
-
const input = getMockFormatterArguments()
|
|
8
|
-
const expectedOutput = format(
|
|
9
|
-
`:root {
|
|
10
|
-
--red: transformedValue;
|
|
11
|
-
}`,
|
|
12
|
-
{
|
|
13
|
-
parser: 'css',
|
|
14
|
-
printWidth: 500,
|
|
15
|
-
},
|
|
16
|
-
)
|
|
17
|
-
expect(cssThemed(input)).toStrictEqual(expectedOutput)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('Formats tokens with custom selectors', () => {
|
|
21
|
-
const input = getMockFormatterArguments({
|
|
22
|
-
options: {
|
|
23
|
-
selector: `[data-color-mode="dark"][data-dark-theme="dark"]`,
|
|
24
|
-
selectorLight: `[data-color-mode="auto"][data-light-theme="dark"]`,
|
|
25
|
-
selectorDark: `[data-color-mode="auto"][data-dark-theme="dark"]`,
|
|
26
|
-
},
|
|
27
|
-
})
|
|
28
|
-
const expectedOutput = format(
|
|
29
|
-
` [data-color-mode="dark"][data-dark-theme="dark"],
|
|
30
|
-
[data-color-mode="auto"][data-light-theme="dark"] {
|
|
31
|
-
--red: transformedValue;
|
|
32
|
-
}
|
|
33
|
-
@media (prefers-color-scheme: dark) {
|
|
34
|
-
[data-color-mode="auto"][data-dark-theme="dark"] {
|
|
35
|
-
--red: transformedValue;
|
|
36
|
-
}
|
|
37
|
-
}`,
|
|
38
|
-
{parser: 'css', printWidth: 500},
|
|
39
|
-
)
|
|
40
|
-
expect(cssThemed(input)).toStrictEqual(expectedOutput)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('Formats tokens with only options.selector', () => {
|
|
44
|
-
const input = getMockFormatterArguments({
|
|
45
|
-
options: {
|
|
46
|
-
selector: `[data-color-mode="dark"]`,
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
const expectedOutput = format(
|
|
50
|
-
`[data-color-mode="dark"]{
|
|
51
|
-
--red: transformedValue;
|
|
52
|
-
}`,
|
|
53
|
-
{parser: 'css', printWidth: 500},
|
|
54
|
-
)
|
|
55
|
-
expect(cssThemed(input)).toStrictEqual(expectedOutput)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('Formats tokens with only options.selectorLight', () => {
|
|
59
|
-
const input = getMockFormatterArguments({
|
|
60
|
-
options: {
|
|
61
|
-
selectorLight: `[data-color-mode="light"]`,
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
const expectedOutput = format(
|
|
65
|
-
`:root, [data-color-mode="light"]{
|
|
66
|
-
--red: transformedValue;
|
|
67
|
-
}`,
|
|
68
|
-
{parser: 'css', printWidth: 500},
|
|
69
|
-
)
|
|
70
|
-
expect(cssThemed(input)).toStrictEqual(expectedOutput)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('Formats tokens with only options.selectorDark', () => {
|
|
74
|
-
const input = getMockFormatterArguments({
|
|
75
|
-
options: {
|
|
76
|
-
selectorLight: `[data-color-mode="dark"]`,
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
const expectedOutput = format(
|
|
80
|
-
`:root, [data-color-mode="dark"]{
|
|
81
|
-
--red: transformedValue;
|
|
82
|
-
}`,
|
|
83
|
-
{parser: 'css', printWidth: 500},
|
|
84
|
-
)
|
|
85
|
-
expect(cssThemed(input)).toStrictEqual(expectedOutput)
|
|
86
|
-
})
|
|
87
|
-
})
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import {cssWrapMediaQuery} from './cssWrapMediaQuery'
|
|
2
|
-
import {getMockDictionary, getMockFormatterArguments, getMockToken} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: tokens nested in media query', () => {
|
|
6
|
-
it('Wraps in screen if no media query defined', () => {
|
|
7
|
-
const input = getMockFormatterArguments()
|
|
8
|
-
const expectedOutput = format(
|
|
9
|
-
` @media screen {
|
|
10
|
-
:root {
|
|
11
|
-
--red: transformedValue;
|
|
12
|
-
}
|
|
13
|
-
}`,
|
|
14
|
-
{parser: 'css', printWidth: 500},
|
|
15
|
-
)
|
|
16
|
-
expect(cssWrapMediaQuery(input)).toStrictEqual(expectedOutput)
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('Wraps in screen if no matching media query is found', () => {
|
|
20
|
-
const input = getMockFormatterArguments({
|
|
21
|
-
options: {
|
|
22
|
-
mediaQuery: {
|
|
23
|
-
'size-fine.css': '(pointer: fine)',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
file: {
|
|
27
|
-
destination: 'size-coarse.css',
|
|
28
|
-
options: {
|
|
29
|
-
showFileHeader: false,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
const expectedOutput = format(
|
|
34
|
-
` @media screen {
|
|
35
|
-
:root {
|
|
36
|
-
--red: transformedValue;
|
|
37
|
-
}
|
|
38
|
-
}`,
|
|
39
|
-
{parser: 'css', printWidth: 500},
|
|
40
|
-
)
|
|
41
|
-
expect(cssWrapMediaQuery(input)).toStrictEqual(expectedOutput)
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('Wraps in defined media query if files match', () => {
|
|
45
|
-
const input = getMockFormatterArguments({
|
|
46
|
-
options: {
|
|
47
|
-
mediaQuery: {
|
|
48
|
-
'size-fine.css': '(pointer: fine)',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
file: {
|
|
52
|
-
destination: 'size-fine.css',
|
|
53
|
-
options: {
|
|
54
|
-
showFileHeader: false,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
const expectedOutput = format(
|
|
59
|
-
` @media (pointer: fine) {
|
|
60
|
-
:root {
|
|
61
|
-
--red: transformedValue;
|
|
62
|
-
}
|
|
63
|
-
}`,
|
|
64
|
-
{parser: 'css', printWidth: 500},
|
|
65
|
-
)
|
|
66
|
-
expect(cssWrapMediaQuery(input)).toStrictEqual(expectedOutput)
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
it('Show comment if option.description is true', () => {
|
|
70
|
-
const input = getMockFormatterArguments({
|
|
71
|
-
dictionary: getMockDictionary({
|
|
72
|
-
tokens: {
|
|
73
|
-
subgroup: {
|
|
74
|
-
red: getMockToken({
|
|
75
|
-
name: 'red',
|
|
76
|
-
value: 'transformedValue',
|
|
77
|
-
comment: 'This is a description',
|
|
78
|
-
}),
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
}),
|
|
82
|
-
options: {
|
|
83
|
-
mediaQuery: {
|
|
84
|
-
'size-fine.css': '(pointer: fine)',
|
|
85
|
-
},
|
|
86
|
-
descriptions: true,
|
|
87
|
-
},
|
|
88
|
-
file: {
|
|
89
|
-
destination: 'size-fine.css',
|
|
90
|
-
options: {
|
|
91
|
-
showFileHeader: false,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
const expectedOutput = format(
|
|
97
|
-
` @media (pointer: fine) {
|
|
98
|
-
:root {
|
|
99
|
-
--red: transformedValue; /* This is a description */
|
|
100
|
-
}
|
|
101
|
-
}`,
|
|
102
|
-
{parser: 'css', printWidth: 500},
|
|
103
|
-
)
|
|
104
|
-
expect(cssWrapMediaQuery(input)).toStrictEqual(expectedOutput)
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
it('Hides comment if option.description is false or not set', () => {
|
|
108
|
-
const input = getMockFormatterArguments({
|
|
109
|
-
dictionary: getMockDictionary({
|
|
110
|
-
tokens: {
|
|
111
|
-
subgroup: {
|
|
112
|
-
red: getMockToken({
|
|
113
|
-
name: 'red',
|
|
114
|
-
value: 'transformedValue',
|
|
115
|
-
comment: 'This is a description',
|
|
116
|
-
}),
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
}),
|
|
120
|
-
options: {
|
|
121
|
-
mediaQuery: {
|
|
122
|
-
'size-fine.css': '(pointer: fine)',
|
|
123
|
-
},
|
|
124
|
-
descriptions: false,
|
|
125
|
-
},
|
|
126
|
-
file: {
|
|
127
|
-
destination: 'size-fine.css',
|
|
128
|
-
options: {
|
|
129
|
-
showFileHeader: false,
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
const inputUnset = getMockFormatterArguments({
|
|
135
|
-
dictionary: getMockDictionary({
|
|
136
|
-
tokens: {
|
|
137
|
-
subgroup: {
|
|
138
|
-
red: getMockToken({
|
|
139
|
-
name: 'red',
|
|
140
|
-
value: 'transformedValue',
|
|
141
|
-
comment: 'This is a description',
|
|
142
|
-
}),
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
}),
|
|
146
|
-
options: {
|
|
147
|
-
mediaQuery: {
|
|
148
|
-
'size-fine.css': '(pointer: fine)',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
file: {
|
|
152
|
-
destination: 'size-fine.css',
|
|
153
|
-
options: {
|
|
154
|
-
showFileHeader: false,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
const expectedOutput = format(
|
|
160
|
-
` @media (pointer: fine) {
|
|
161
|
-
:root {
|
|
162
|
-
--red: transformedValue;
|
|
163
|
-
}
|
|
164
|
-
}`,
|
|
165
|
-
{parser: 'css', printWidth: 500},
|
|
166
|
-
)
|
|
167
|
-
expect(cssWrapMediaQuery(input)).toStrictEqual(expectedOutput)
|
|
168
|
-
expect(cssWrapMediaQuery(inputUnset)).toStrictEqual(expectedOutput)
|
|
169
|
-
})
|
|
170
|
-
})
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {javascriptCommonJs} from './javascriptCommonJs'
|
|
2
|
-
import {getMockFormatterArguments} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: CommonJs', () => {
|
|
6
|
-
it('Formats tokens adding prefix', () => {
|
|
7
|
-
const input = getMockFormatterArguments({
|
|
8
|
-
platform: {
|
|
9
|
-
prefix: 'test',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const expectedOutput = format(
|
|
14
|
-
`exports.default = {
|
|
15
|
-
test: {
|
|
16
|
-
tokens: {
|
|
17
|
-
subgroup: {
|
|
18
|
-
red: "transformedValue",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};`,
|
|
23
|
-
{parser: 'typescript', printWidth: 500},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
expect(javascriptCommonJs(input)).toBe(expectedOutput)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('Formats tokens without prefix', () => {
|
|
30
|
-
const input = getMockFormatterArguments()
|
|
31
|
-
const expectedOutput = format(
|
|
32
|
-
`exports.default = {
|
|
33
|
-
tokens: {
|
|
34
|
-
subgroup: {
|
|
35
|
-
red: "transformedValue",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};`,
|
|
39
|
-
{parser: 'typescript', printWidth: 500},
|
|
40
|
-
)
|
|
41
|
-
expect(javascriptCommonJs(input)).toStrictEqual(expectedOutput)
|
|
42
|
-
})
|
|
43
|
-
})
|