@adobe/spectrum-tokens 14.10.0 → 14.12.0
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/CHANGELOG.md +39 -0
- package/dist/json/variables.json +6337 -6457
- package/moon.yml +14 -0
- package/package.json +1 -1
- package/schemas/token-types/alias.json +49 -8
- package/schemas/token-types/multiplier.json +1 -1
- package/schemas/token-types/token.json +6 -2
- package/src/color-aliases.json +1121 -1121
- package/src/color-component.json +228 -228
- package/src/color-palette.json +2852 -4695
- package/src/icons.json +550 -858
- package/src/layout-component.json +4545 -4627
- package/src/layout.json +1335 -1348
- package/src/semantic-color-palette.json +228 -228
- package/src/typography.json +720 -912
- package/test/schemaValidators/alias.test.js +48 -6
|
@@ -26,16 +26,58 @@ const validate = await ajv.compile(
|
|
|
26
26
|
await readJSON("schemas/token-types/alias.json"),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const ALIAS_SCHEMA =
|
|
30
|
+
"https://opensource.adobe.com/spectrum-design-data/schemas/token-types/alias.json";
|
|
31
|
+
|
|
32
|
+
test("cascade $ref-only alias validates (oneOf cascade branch)", (t) => {
|
|
33
|
+
const alias = {
|
|
34
|
+
$schema: ALIAS_SCHEMA,
|
|
35
|
+
$ref: "87a2c8f0-54fd-4939-8f42-3124fde1e49e",
|
|
36
|
+
uuid: "f24eb871-6419-4cef-88a2-cca8548ae31e",
|
|
37
|
+
};
|
|
38
|
+
const valid = validate(alias);
|
|
39
|
+
if (!valid) {
|
|
40
|
+
t.log("Validation errors:", validate.errors);
|
|
41
|
+
}
|
|
42
|
+
t.true(valid, "cascade alias with $ref and uuid must validate");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("legacy value-form alias validates (oneOf legacy branch)", (t) => {
|
|
30
46
|
const alias = {
|
|
31
47
|
component: "swatch",
|
|
32
|
-
$schema:
|
|
33
|
-
"https://opensource.adobe.com/spectrum-design-data/schemas/token-types/alias.json",
|
|
48
|
+
$schema: ALIAS_SCHEMA,
|
|
34
49
|
value: "{gray-900}",
|
|
35
50
|
uuid: "7da5157d-7f25-405b-8de0-f3669565fb48",
|
|
36
51
|
};
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
const valid = validate(alias);
|
|
53
|
+
if (!valid) {
|
|
54
|
+
t.log("Validation errors:", validate.errors);
|
|
39
55
|
}
|
|
40
|
-
t.
|
|
56
|
+
t.true(valid, "legacy alias with value:'{name}' and uuid must validate");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("alias with both $ref and value is rejected by oneOf", (t) => {
|
|
60
|
+
const alias = {
|
|
61
|
+
$schema: ALIAS_SCHEMA,
|
|
62
|
+
$ref: "87a2c8f0-54fd-4939-8f42-3124fde1e49e",
|
|
63
|
+
value: "{gray-900}",
|
|
64
|
+
uuid: "f24eb871-6419-4cef-88a2-cca8548ae31e",
|
|
65
|
+
};
|
|
66
|
+
t.false(
|
|
67
|
+
validate(alias),
|
|
68
|
+
"alias carrying both $ref and value must be rejected (oneOf not both)",
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("legacy value with illegal characters in braces is rejected", (t) => {
|
|
73
|
+
const alias = {
|
|
74
|
+
$schema: ALIAS_SCHEMA,
|
|
75
|
+
// Dots and slashes are not allowed inside {…} by the legacy pattern.
|
|
76
|
+
value: "{a.b}",
|
|
77
|
+
uuid: "7da5157d-7f25-405b-8de0-f3669565fb48",
|
|
78
|
+
};
|
|
79
|
+
t.false(
|
|
80
|
+
validate(alias),
|
|
81
|
+
"value:'{a.b}' violates the \\{(\\w|-)*\\} pattern and must be rejected",
|
|
82
|
+
);
|
|
41
83
|
});
|