@primer/primitives 7.17.0-rc.61b28bca → 7.17.0-rc.8ff6ed39
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 +2 -3
- 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/dist/deprecated/colors.json +0 -7
- package/dist/js/colors/dark.d.ts +0 -516
- package/dist/js/colors/dark.js +0 -616
- package/dist/js/colors/dark_colorblind.d.ts +0 -516
- package/dist/js/colors/dark_colorblind.js +0 -616
- package/dist/js/colors/dark_dimmed.d.ts +0 -516
- package/dist/js/colors/dark_dimmed.js +0 -616
- package/dist/js/colors/dark_high_contrast.d.ts +0 -516
- package/dist/js/colors/dark_high_contrast.js +0 -616
- package/dist/js/colors/dark_tritanopia.d.ts +0 -516
- package/dist/js/colors/dark_tritanopia.js +0 -616
- package/dist/js/colors/index.d.ts +0 -4638
- package/dist/js/colors/index.js +0 -15
- package/dist/js/colors/light.d.ts +0 -516
- package/dist/js/colors/light.js +0 -616
- package/dist/js/colors/light_colorblind.d.ts +0 -516
- package/dist/js/colors/light_colorblind.js +0 -616
- package/dist/js/colors/light_high_contrast.d.ts +0 -516
- package/dist/js/colors/light_high_contrast.js +0 -616
- package/dist/js/colors/light_tritanopia.d.ts +0 -516
- package/dist/js/colors/light_tritanopia.js +0 -616
- package/dist/js/index.d.ts +0 -4655
- package/dist/js/index.js +0 -9
- package/dist/js/spacing/index.d.ts +0 -6
- package/dist/js/spacing/index.js +0 -7
- package/dist/js/spacing/normal.d.ts +0 -4
- package/dist/js/spacing/normal.js +0 -13
- package/dist/js/typography/index.d.ts +0 -11
- package/dist/js/typography/index.js +0 -7
- package/dist/js/typography/normal.d.ts +0 -9
- package/dist/js/typography/normal.js +0 -19
- package/dist/json/colors/dark.json +0 -614
- package/dist/json/colors/dark_colorblind.json +0 -614
- package/dist/json/colors/dark_dimmed.json +0 -614
- package/dist/json/colors/dark_high_contrast.json +0 -614
- package/dist/json/colors/dark_tritanopia.json +0 -614
- package/dist/json/colors/light.json +0 -614
- package/dist/json/colors/light_colorblind.json +0 -614
- package/dist/json/colors/light_high_contrast.json +0 -614
- package/dist/json/colors/light_tritanopia.json +0 -614
- package/dist/json/spacing/normal.json +0 -11
- package/dist/json/typography/normal.json +0 -17
- package/dist/removed/colors.json +0 -432
- package/dist/scss/colors/_dark.scss +0 -452
- package/dist/scss/colors/_dark_colorblind.scss +0 -452
- package/dist/scss/colors/_dark_dimmed.scss +0 -452
- package/dist/scss/colors/_dark_high_contrast.scss +0 -452
- package/dist/scss/colors/_dark_tritanopia.scss +0 -452
- package/dist/scss/colors/_light.scss +0 -452
- package/dist/scss/colors/_light_colorblind.scss +0 -452
- package/dist/scss/colors/_light_high_contrast.scss +0 -452
- package/dist/scss/colors/_light_tritanopia.scss +0 -452
- package/dist/scss/spacing/_normal.scss +0 -11
- package/dist/scss/typography/_normal.scss +0 -15
- package/dist/ts/colors/dark.ts +0 -614
- package/dist/ts/colors/dark_colorblind.ts +0 -614
- package/dist/ts/colors/dark_dimmed.ts +0 -614
- package/dist/ts/colors/dark_high_contrast.ts +0 -614
- package/dist/ts/colors/dark_tritanopia.ts +0 -614
- package/dist/ts/colors/index.ts +0 -10
- package/dist/ts/colors/light.ts +0 -614
- package/dist/ts/colors/light_colorblind.ts +0 -614
- package/dist/ts/colors/light_high_contrast.ts +0 -614
- package/dist/ts/colors/light_tritanopia.ts +0 -614
- package/dist/ts/index.ts +0 -4
- package/dist/ts/spacing/index.ts +0 -2
- package/dist/ts/spacing/normal.ts +0 -11
- package/dist/ts/typography/index.ts +0 -2
- package/dist/ts/typography/normal.ts +0 -17
- 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,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
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {javascriptEsm} from './javascriptEsm'
|
|
2
|
-
import {getMockFormatterArguments} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: ESM', () => {
|
|
6
|
-
it('Formats tokens adding prefix', () => {
|
|
7
|
-
const input = getMockFormatterArguments({
|
|
8
|
-
platform: {
|
|
9
|
-
prefix: 'test',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
const expectedOutput = format(
|
|
13
|
-
`export default {
|
|
14
|
-
test: {
|
|
15
|
-
tokens: {
|
|
16
|
-
subgroup: {
|
|
17
|
-
red: "transformedValue",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};`,
|
|
22
|
-
{parser: 'typescript', printWidth: 500},
|
|
23
|
-
)
|
|
24
|
-
expect(javascriptEsm(input)).toStrictEqual(expectedOutput)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('Formats tokens without prefix', () => {
|
|
28
|
-
const input = getMockFormatterArguments()
|
|
29
|
-
const expectedOutput = format(
|
|
30
|
-
`export default {
|
|
31
|
-
tokens: {
|
|
32
|
-
subgroup: {
|
|
33
|
-
red: "transformedValue",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};`,
|
|
37
|
-
{parser: 'typescript', printWidth: 500},
|
|
38
|
-
)
|
|
39
|
-
expect(javascriptEsm(input)).toStrictEqual(expectedOutput)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {jsonNestedPrefixed} from './jsonNestedPrefixed'
|
|
2
|
-
import {getMockFormatterArguments} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: Json nested with prefixes', () => {
|
|
6
|
-
test('Formats tokens with prefix', () => {
|
|
7
|
-
const input = getMockFormatterArguments({
|
|
8
|
-
platform: {
|
|
9
|
-
prefix: 'test',
|
|
10
|
-
},
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const expectedOutput = format(
|
|
14
|
-
`{
|
|
15
|
-
"test": {
|
|
16
|
-
"tokens": {
|
|
17
|
-
"subgroup": {
|
|
18
|
-
"red": "transformedValue"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}`,
|
|
23
|
-
{parser: 'json', printWidth: 500},
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
expect(jsonNestedPrefixed(input)).toBe(expectedOutput)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
test('Formats tokens without prefix', () => {
|
|
30
|
-
const input = getMockFormatterArguments()
|
|
31
|
-
const expectedOutput = format(
|
|
32
|
-
`{
|
|
33
|
-
"tokens": {
|
|
34
|
-
"subgroup": {
|
|
35
|
-
"red": "transformedValue"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}`,
|
|
39
|
-
{parser: 'json', printWidth: 500},
|
|
40
|
-
)
|
|
41
|
-
expect(jsonNestedPrefixed(input)).toStrictEqual(expectedOutput)
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
test('Formats tokens without verbose setting', () => {
|
|
45
|
-
const input = getMockFormatterArguments({
|
|
46
|
-
options: {
|
|
47
|
-
outputVerbose: true,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
const expectedOutput = format(
|
|
51
|
-
`{
|
|
52
|
-
"tokens": {
|
|
53
|
-
"subgroup": {
|
|
54
|
-
"red": {
|
|
55
|
-
"name": "red",
|
|
56
|
-
"path": ["tokens", "subgroup", "red"],
|
|
57
|
-
"original": {
|
|
58
|
-
"value": "originalValue",
|
|
59
|
-
"attributes": {}
|
|
60
|
-
},
|
|
61
|
-
"filePath": "file.json",
|
|
62
|
-
"isSource": true,
|
|
63
|
-
"value": "transformedValue",
|
|
64
|
-
"attributes": {}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}`,
|
|
69
|
-
{parser: 'json', printWidth: 500},
|
|
70
|
-
)
|
|
71
|
-
expect(jsonNestedPrefixed(input)).toStrictEqual(expectedOutput)
|
|
72
|
-
})
|
|
73
|
-
})
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {jsonOneDimensional} from './jsonOneDimensional'
|
|
2
|
-
import {getMockDictionary, getMockFormatterArguments, getMockToken} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: Json One Dimensional', () => {
|
|
6
|
-
const dictionary = getMockDictionary({
|
|
7
|
-
tokens: {
|
|
8
|
-
subgroup: {
|
|
9
|
-
red: getMockToken({
|
|
10
|
-
name: 'tokens-subgroup-red',
|
|
11
|
-
path: ['tokens', 'subgroup', 'red'],
|
|
12
|
-
}),
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test('Formats tokens as object', () => {
|
|
18
|
-
const input = getMockFormatterArguments({
|
|
19
|
-
dictionary,
|
|
20
|
-
options: {outputVerbose: true},
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const expectedOutput = format(
|
|
24
|
-
`{
|
|
25
|
-
"tokens-subgroup-red": {
|
|
26
|
-
"name": "tokens-subgroup-red",
|
|
27
|
-
"path": ["tokens", "subgroup", "red"],
|
|
28
|
-
"original": {
|
|
29
|
-
"value": "originalValue",
|
|
30
|
-
"attributes": {}
|
|
31
|
-
},
|
|
32
|
-
"filePath": "file.json",
|
|
33
|
-
"isSource": true,
|
|
34
|
-
"value": "transformedValue",
|
|
35
|
-
"attributes": {}
|
|
36
|
-
}
|
|
37
|
-
}`,
|
|
38
|
-
{parser: 'json', printWidth: 500},
|
|
39
|
-
)
|
|
40
|
-
expect(jsonOneDimensional(input)).toStrictEqual(expectedOutput)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
test('Formats tokens as values only', () => {
|
|
44
|
-
const input = getMockFormatterArguments({
|
|
45
|
-
dictionary,
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const expectedOutput = format(
|
|
49
|
-
`{
|
|
50
|
-
"tokens-subgroup-red": "transformedValue"
|
|
51
|
-
}`,
|
|
52
|
-
{parser: 'json', printWidth: 500},
|
|
53
|
-
)
|
|
54
|
-
expect(jsonOneDimensional(input)).toStrictEqual(expectedOutput)
|
|
55
|
-
})
|
|
56
|
-
})
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import {typescriptExportDefinition} from './typescriptExportDefinition'
|
|
2
|
-
import {getMockFormatterArguments, getMockDictionary, getMockToken} from '../test-utilities'
|
|
3
|
-
import {format} from 'prettier'
|
|
4
|
-
|
|
5
|
-
describe('Format: TypeScript definitions', () => {
|
|
6
|
-
const dictionary = getMockDictionary({
|
|
7
|
-
tokens: {
|
|
8
|
-
subgroup: {
|
|
9
|
-
red: getMockToken({
|
|
10
|
-
$type: 'color',
|
|
11
|
-
value: '#FF0000',
|
|
12
|
-
}),
|
|
13
|
-
stringValue: getMockToken({
|
|
14
|
-
value: '#FF0000',
|
|
15
|
-
}),
|
|
16
|
-
border: getMockToken({
|
|
17
|
-
$type: 'border',
|
|
18
|
-
value: {
|
|
19
|
-
color: '#FF0000',
|
|
20
|
-
style: 'solid',
|
|
21
|
-
width: '1px',
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
numberValue: getMockToken({
|
|
25
|
-
value: 20,
|
|
26
|
-
}),
|
|
27
|
-
booleanValue: getMockToken({
|
|
28
|
-
value: true,
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('Formats dimension tokens', () => {
|
|
35
|
-
const input = getMockFormatterArguments({
|
|
36
|
-
dictionary: getMockDictionary({
|
|
37
|
-
tokens: {
|
|
38
|
-
subgroup: {
|
|
39
|
-
size: {
|
|
40
|
-
px: getMockToken({
|
|
41
|
-
$type: 'dimension',
|
|
42
|
-
value: '100px',
|
|
43
|
-
}),
|
|
44
|
-
rem: getMockToken({
|
|
45
|
-
$type: 'dimension',
|
|
46
|
-
value: '10rem',
|
|
47
|
-
}),
|
|
48
|
-
em: getMockToken({
|
|
49
|
-
$type: 'dimension',
|
|
50
|
-
value: '10em',
|
|
51
|
-
}),
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
56
|
-
})
|
|
57
|
-
const expectedOutput = format(
|
|
58
|
-
`/**
|
|
59
|
-
* @description size in px
|
|
60
|
-
*/
|
|
61
|
-
type SizePx = \`\${number}px\`
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @description size in rem
|
|
65
|
-
*/
|
|
66
|
-
type SizeRem = \`\${number}rem\`
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @description size in em
|
|
70
|
-
*/
|
|
71
|
-
type SizeEm = \`\${number}em\`
|
|
72
|
-
|
|
73
|
-
export type tokens = {
|
|
74
|
-
tokens: {
|
|
75
|
-
subgroup: {
|
|
76
|
-
size: {
|
|
77
|
-
px: SizePx;
|
|
78
|
-
rem: SizeRem;
|
|
79
|
-
em: SizeEm;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
};`,
|
|
84
|
-
{parser: 'typescript', printWidth: 500},
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
expect(typescriptExportDefinition(input)).toStrictEqual(expectedOutput)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('Formats tokens adding prefix', () => {
|
|
91
|
-
const input = getMockFormatterArguments({
|
|
92
|
-
dictionary,
|
|
93
|
-
platform: {
|
|
94
|
-
prefix: 'test',
|
|
95
|
-
},
|
|
96
|
-
})
|
|
97
|
-
const expectedOutput = format(
|
|
98
|
-
`/**
|
|
99
|
-
* @description hex string (6 or 8-digit)
|
|
100
|
-
*/
|
|
101
|
-
type ColorHex = string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @description a css border string
|
|
105
|
-
* @format color | style | width
|
|
106
|
-
*/
|
|
107
|
-
type Border = \`\${ColorHex} \${string} \${string}\`;
|
|
108
|
-
|
|
109
|
-
export type tokens = {
|
|
110
|
-
test: {
|
|
111
|
-
tokens: {
|
|
112
|
-
subgroup: {
|
|
113
|
-
red: ColorHex;
|
|
114
|
-
stringValue: string;
|
|
115
|
-
border: Border;
|
|
116
|
-
numberValue: number;
|
|
117
|
-
booleanValue: "boolean";
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
};`,
|
|
122
|
-
{parser: 'typescript', printWidth: 500},
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
expect(typescriptExportDefinition(input)).toStrictEqual(expectedOutput)
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
it('Formats tokens without prefix', () => {
|
|
129
|
-
const input = getMockFormatterArguments({dictionary})
|
|
130
|
-
const expectedOutput = format(
|
|
131
|
-
`/**
|
|
132
|
-
* @description hex string (6 or 8-digit)
|
|
133
|
-
*/
|
|
134
|
-
type ColorHex = string;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @description a css border string
|
|
138
|
-
* @format color | style | width
|
|
139
|
-
*/
|
|
140
|
-
type Border = \`\${ColorHex} \${string} \${string}\`;
|
|
141
|
-
|
|
142
|
-
export type tokens = {
|
|
143
|
-
tokens: {
|
|
144
|
-
subgroup: {
|
|
145
|
-
red: ColorHex;
|
|
146
|
-
stringValue: string;
|
|
147
|
-
border: Border;
|
|
148
|
-
numberValue: number;
|
|
149
|
-
booleanValue: "boolean";
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
};`,
|
|
153
|
-
{parser: 'typescript', printWidth: 500},
|
|
154
|
-
)
|
|
155
|
-
expect(typescriptExportDefinition(input)).toStrictEqual(expectedOutput)
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
it('throws an invalidTokenValue error if a token has an invalid value for the defined type', () => {
|
|
159
|
-
const input = getMockFormatterArguments({
|
|
160
|
-
dictionary: getMockDictionary({
|
|
161
|
-
// @ts-expect-error: Because of invalid token
|
|
162
|
-
tokens: {
|
|
163
|
-
subgroup: {
|
|
164
|
-
color: {
|
|
165
|
-
name: 'color token name',
|
|
166
|
-
value: 'rgb(100,200,255)',
|
|
167
|
-
$type: 'color',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
}),
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
expect(() => {
|
|
175
|
-
typescriptExportDefinition(input)
|
|
176
|
-
}).toThrowError('Invalid token: "color token name" with type "color" can not have a value of "rgb(100,200,255)"')
|
|
177
|
-
})
|
|
178
|
-
})
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../../test-utilities'
|
|
2
|
-
import {jsonToFlat} from './jsonToFlat'
|
|
3
|
-
|
|
4
|
-
describe('Utilities: jsonToFlat', () => {
|
|
5
|
-
const tokens = [
|
|
6
|
-
getMockToken({
|
|
7
|
-
value: '#111',
|
|
8
|
-
$type: 'color',
|
|
9
|
-
path: ['parent', 'subparent', 'child1'],
|
|
10
|
-
name: 'parent-subparent-child1',
|
|
11
|
-
}),
|
|
12
|
-
getMockToken({
|
|
13
|
-
value: '#222',
|
|
14
|
-
$type: 'color',
|
|
15
|
-
path: ['parent', 'subparent', 'child2'],
|
|
16
|
-
name: 'parent-subparent-child2',
|
|
17
|
-
}),
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
it('it returns only value property as value of object if return Object is false', () => {
|
|
21
|
-
expect(jsonToFlat(tokens, false)['parent-subparent-child1']).toBe('#111')
|
|
22
|
-
expect(jsonToFlat(tokens, false)).toStrictEqual({
|
|
23
|
-
'parent-subparent-child1': '#111',
|
|
24
|
-
'parent-subparent-child2': '#222',
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('it returns objects as value of object if return Object is true', () => {
|
|
29
|
-
expect(jsonToFlat(tokens, true)['parent-subparent-child1']).toEqual({
|
|
30
|
-
value: '#111',
|
|
31
|
-
$type: 'color',
|
|
32
|
-
path: ['parent', 'subparent', 'child1'],
|
|
33
|
-
name: 'parent-subparent-child1',
|
|
34
|
-
attributes: {},
|
|
35
|
-
filePath: 'file.json',
|
|
36
|
-
isSource: true,
|
|
37
|
-
original: {
|
|
38
|
-
attributes: {},
|
|
39
|
-
value: 'originalValue',
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('it returns only value property as value of object if return Object is undefined', () => {
|
|
45
|
-
expect(jsonToFlat(tokens, undefined)['parent-subparent-child1']).toBe('#111')
|
|
46
|
-
})
|
|
47
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {jsonToNestedValue} from './jsonToNestedValue'
|
|
2
|
-
|
|
3
|
-
describe('Utilities: jsonToNestedValue', () => {
|
|
4
|
-
const obj = {
|
|
5
|
-
parent: {
|
|
6
|
-
subparent: {
|
|
7
|
-
child1: {
|
|
8
|
-
value: '#111',
|
|
9
|
-
$type: 'color',
|
|
10
|
-
},
|
|
11
|
-
child2: {
|
|
12
|
-
value: '#222',
|
|
13
|
-
$type: 'color',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
otherSubparent: {
|
|
17
|
-
text: 'hello',
|
|
18
|
-
number: 42,
|
|
19
|
-
noValue: {
|
|
20
|
-
string: 'string',
|
|
21
|
-
number: 12,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
it('it returns only value property as value of object', () => {
|
|
28
|
-
expect(jsonToNestedValue(obj.parent.subparent.child1)).toBe('#111')
|
|
29
|
-
expect(jsonToNestedValue(obj['parent']['subparent'])).toStrictEqual({child1: '#111', child2: '#222'})
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('it returns only values if final child is no object', () => {
|
|
33
|
-
const transformedObj = obj
|
|
34
|
-
// @ts-expect-error: fake token for test causes error
|
|
35
|
-
transformedObj['parent']['subparent'] = {child1: '#111', child2: '#222'}
|
|
36
|
-
|
|
37
|
-
expect(jsonToNestedValue(obj)).toStrictEqual(transformedObj)
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {getMockToken} from '../../test-utilities'
|
|
2
|
-
import {prefixTokens} from './prefixTokens'
|
|
3
|
-
|
|
4
|
-
describe('Utilities: prefixTokens', () => {
|
|
5
|
-
const tokens = {
|
|
6
|
-
colors: getMockToken({
|
|
7
|
-
name: 'token',
|
|
8
|
-
value: 'value',
|
|
9
|
-
}),
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
it('it adds prefix to token array', () => {
|
|
13
|
-
const platform = {
|
|
14
|
-
prefix: 'pumpkin',
|
|
15
|
-
}
|
|
16
|
-
const expectedOutput = {
|
|
17
|
-
[platform.prefix]: tokens,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
expect(prefixTokens(tokens, platform)).toStrictEqual(expectedOutput)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('it returns original token array if prefix is undefined', () => {
|
|
24
|
-
const platform = {
|
|
25
|
-
prefix: undefined,
|
|
26
|
-
}
|
|
27
|
-
const expectedOutput = tokens
|
|
28
|
-
|
|
29
|
-
expect(prefixTokens(tokens, platform)).toStrictEqual(expectedOutput)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('it returns original token array if platform is undefined', () => {
|
|
33
|
-
const platform = undefined
|
|
34
|
-
const expectedOutput = tokens
|
|
35
|
-
|
|
36
|
-
expect(prefixTokens(tokens, platform)).toStrictEqual(expectedOutput)
|
|
37
|
-
})
|
|
38
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {w3cJsonParser} from './w3cJsonParser'
|
|
2
|
-
import {parserOutput as expectedOutput, getMockParserInput} from '../test-utilities'
|
|
3
|
-
|
|
4
|
-
describe('Parser: w3c token json5 parser', () => {
|
|
5
|
-
it('parses valid w3c json5', () => {
|
|
6
|
-
const result = w3cJsonParser.parse(getMockParserInput('json5.w3c'))
|
|
7
|
-
expect(result).toStrictEqual(expectedOutput)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('parses valid w3c json', () => {
|
|
11
|
-
const result = w3cJsonParser.parse(getMockParserInput('json.w3c'))
|
|
12
|
-
expect(result).toStrictEqual(expectedOutput)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('parses valid json5', () => {
|
|
16
|
-
const result = w3cJsonParser.parse(getMockParserInput('json5.default'))
|
|
17
|
-
expect(result).toStrictEqual(expectedOutput)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('parses valid json', () => {
|
|
21
|
-
const result = w3cJsonParser.parse(getMockParserInput('json.default'))
|
|
22
|
-
expect(result).toStrictEqual(expectedOutput)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('it parses empty object `{}` json', () => {
|
|
26
|
-
const result = w3cJsonParser.parse(getMockParserInput('{}'))
|
|
27
|
-
expect(result).toStrictEqual({})
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('throws an error while parsing invalid empty JSON', () => {
|
|
31
|
-
expect(() => {
|
|
32
|
-
w3cJsonParser.parse(getMockParserInput('', 'invalidFile.json'))
|
|
33
|
-
}).toThrow(`Invalid json5 file "invalidFile.json".`)
|
|
34
|
-
})
|
|
35
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {alphaValue} from './alphaValue'
|
|
2
|
-
|
|
3
|
-
describe('Schema: alphaValue', () => {
|
|
4
|
-
it('passes on valid alpha values', () => {
|
|
5
|
-
expect(alphaValue.safeParse(0).success).toStrictEqual(true)
|
|
6
|
-
expect(alphaValue.safeParse(0.5).success).toStrictEqual(true)
|
|
7
|
-
expect(alphaValue.safeParse(0.23455).success).toStrictEqual(true)
|
|
8
|
-
expect(alphaValue.safeParse(1).success).toStrictEqual(true)
|
|
9
|
-
expect(alphaValue.safeParse(1.0).success).toStrictEqual(true)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('fails on invalid alpha values', () => {
|
|
13
|
-
expect(alphaValue.safeParse(-1).success).toStrictEqual(false)
|
|
14
|
-
expect(alphaValue.safeParse(-0.1).success).toStrictEqual(false)
|
|
15
|
-
expect(alphaValue.safeParse(1.1).success).toStrictEqual(false)
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('fails on non-numeric values', () => {
|
|
19
|
-
expect(alphaValue.safeParse('1').success).toStrictEqual(false)
|
|
20
|
-
expect(alphaValue.safeParse(undefined).success).toStrictEqual(false)
|
|
21
|
-
expect(alphaValue.safeParse(null).success).toStrictEqual(false)
|
|
22
|
-
expect(alphaValue.safeParse('').success).toStrictEqual(false)
|
|
23
|
-
})
|
|
24
|
-
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {baseToken} from './baseToken'
|
|
2
|
-
|
|
3
|
-
describe('Schema: baseToken', () => {
|
|
4
|
-
const validToken = {
|
|
5
|
-
$description: 'a base token',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
it('passes on valid values', () => {
|
|
9
|
-
expect(baseToken.safeParse(validToken).success).toStrictEqual(true)
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('fails on invalid property', () => {
|
|
13
|
-
expect(baseToken.safeParse({...validToken, $type: 'stroke'}).success).toStrictEqual(false)
|
|
14
|
-
expect(baseToken.safeParse({...validToken, $value: 'wrong'}).success).toStrictEqual(false)
|
|
15
|
-
expect(baseToken.safeParse({...validToken, $additional: undefined}).success).toStrictEqual(false)
|
|
16
|
-
})
|
|
17
|
-
})
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {borderToken, borderValue} from './borderToken'
|
|
2
|
-
|
|
3
|
-
const validBorderValue = {
|
|
4
|
-
color: '#333',
|
|
5
|
-
style: 'solid',
|
|
6
|
-
width: '1px',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe('Schema: borderValue', () => {
|
|
10
|
-
it('passes on valid values', () => {
|
|
11
|
-
expect(borderValue.safeParse(validBorderValue).success).toStrictEqual(true)
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('passes on valid stroke values', () => {
|
|
15
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'solid'}).success).toStrictEqual(true)
|
|
16
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'dashed'}).success).toStrictEqual(true)
|
|
17
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'dotted'}).success).toStrictEqual(true)
|
|
18
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'double'}).success).toStrictEqual(true)
|
|
19
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'groove'}).success).toStrictEqual(true)
|
|
20
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'ridge'}).success).toStrictEqual(true)
|
|
21
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'outset'}).success).toStrictEqual(true)
|
|
22
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'inset'}).success).toStrictEqual(true)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('fails on invalid values', () => {
|
|
26
|
-
expect(borderValue.safeParse({...validBorderValue, style: 'none'}).success).toStrictEqual(false)
|
|
27
|
-
expect(borderValue.safeParse({...validBorderValue, color: 'none'}).success).toStrictEqual(false)
|
|
28
|
-
expect(borderValue.safeParse({...validBorderValue, width: '1%'}).success).toStrictEqual(false)
|
|
29
|
-
expect(borderValue.safeParse({...validBorderValue, width: '1vw'}).success).toStrictEqual(false)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('fails on missing values', () => {
|
|
33
|
-
expect(borderValue.safeParse({...validBorderValue, style: undefined}).success).toStrictEqual(false)
|
|
34
|
-
expect(borderValue.safeParse({...validBorderValue, color: undefined}).success).toStrictEqual(false)
|
|
35
|
-
expect(borderValue.safeParse({...validBorderValue, width: undefined}).success).toStrictEqual(false)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
describe('Schema: borderToken', () => {
|
|
40
|
-
const validBorderToken = {
|
|
41
|
-
$value: validBorderValue,
|
|
42
|
-
$type: 'border',
|
|
43
|
-
$description: 'a border token',
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
it('passes on valid values', () => {
|
|
47
|
-
expect(borderToken.safeParse(validBorderToken).success).toStrictEqual(true)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('fails on invalid type', () => {
|
|
51
|
-
expect(borderToken.safeParse({...validBorderToken, $type: 'stroke'}).success).toStrictEqual(false)
|
|
52
|
-
})
|
|
53
|
-
})
|