@bookklik/senangstart-css 0.2.7 → 0.2.9
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/senangstart-css.js +9052 -2142
- package/dist/senangstart-css.min.js +1207 -119
- package/dist/senangstart-tw.js +170 -73
- package/dist/senangstart-tw.min.js +1 -1
- package/docs/guide/configuration.md +2 -2
- package/docs/guide/states.md +60 -0
- package/docs/ms/guide/configuration.md +2 -2
- package/docs/ms/guide/states.md +60 -0
- package/docs/ms/reference/colors.md +2 -2
- package/docs/ms/reference/space/height.md +10 -10
- package/docs/ms/reference/space/width.md +12 -12
- package/docs/public/assets/senangstart-css.min.js +1207 -119
- package/docs/public/llms.txt +28 -0
- package/docs/reference/colors.md +2 -2
- package/docs/reference/space/height.md +10 -10
- package/docs/reference/space/width.md +12 -12
- package/package.json +1 -1
- package/public/senangstart.css +1196 -0
- package/scripts/convert-tailwind.js +191 -68
- package/scripts/generate-llms-txt.js +28 -0
- package/src/cdn/senangstart-engine.js +36 -2268
- package/src/cdn/tw-conversion-engine.js +203 -74
- package/src/compiler/generators/css.js +309 -249
- package/src/compiler/parser.js +14 -4
- package/src/compiler/tokenizer.js +0 -1
- package/src/config/defaults.js +1 -1
- package/src/core/constants.js +5 -3
- package/src/core/tokenizer-core.js +3 -58
- package/src/definitions/index.js +3 -2
- package/src/definitions/layout.js +6 -2
- package/src/definitions/space.js +45 -19
- package/src/index.js +47 -0
- package/src/utils/common.js +27 -0
- package/templates/senangstart.config.js +1 -1
- package/tests/helpers/test-utils.js +1 -1
- package/tests/integration/compiler.test.js +12 -1
- package/tests/unit/compiler/generators/css.coverage.test.js +833 -0
- package/tests/unit/compiler/generators/css.test.js +1418 -1
- package/tests/unit/compiler/generators/preflight.test.js +31 -0
- package/tests/unit/compiler/parser.test.js +26 -0
- package/tests/unit/config/defaults.test.js +2 -2
- package/tests/unit/convert-tailwind.cli.test.js +95 -0
- package/tests/unit/convert-tailwind.coverage.test.js +225 -0
- package/tests/unit/convert-tailwind.test.js +49 -20
- package/tests/unit/core/tokenizer-core.test.js +102 -0
- package/tests/unit/definitions/index.test.js +108 -0
- package/tests/unit/definitions/layout_definitions.test.js +40 -0
- package/tests/unit/utils/common.test.js +26 -0
- package/scripts/bundle-jit.js +0 -45
|
@@ -433,6 +433,82 @@ describe('CSS Generator', () => {
|
|
|
433
433
|
|
|
434
434
|
});
|
|
435
435
|
|
|
436
|
+
describe('CSS Color Keywords', () => {
|
|
437
|
+
|
|
438
|
+
it('generates bg:transparent without var() wrapping', () => {
|
|
439
|
+
const token = { property: 'bg', value: 'transparent', attrType: 'visual', raw: 'bg:transparent' };
|
|
440
|
+
const config = createTestConfig();
|
|
441
|
+
const css = generateCSS([token], config);
|
|
442
|
+
|
|
443
|
+
assert.ok(css.includes('background-color: transparent'));
|
|
444
|
+
assert.ok(!css.includes('var(--c-transparent)'));
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
it('generates text:currentColor without var() wrapping', () => {
|
|
448
|
+
const token = { property: 'text', value: 'currentColor', attrType: 'visual', raw: 'text:currentColor' };
|
|
449
|
+
const config = createTestConfig();
|
|
450
|
+
const css = generateCSS([token], config);
|
|
451
|
+
|
|
452
|
+
assert.ok(css.includes('color: currentColor'));
|
|
453
|
+
assert.ok(!css.includes('var(--c-currentColor)'));
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it('generates border:transparent without var() wrapping', () => {
|
|
457
|
+
const token = { property: 'border', value: 'transparent', attrType: 'visual', raw: 'border:transparent' };
|
|
458
|
+
const config = createTestConfig();
|
|
459
|
+
const css = generateCSS([token], config);
|
|
460
|
+
|
|
461
|
+
assert.ok(css.includes('border-color: transparent'));
|
|
462
|
+
assert.ok(!css.includes('var(--c-transparent)'));
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it('generates border:inherit without var() wrapping', () => {
|
|
466
|
+
const token = { property: 'border', value: 'inherit', attrType: 'visual', raw: 'border:inherit' };
|
|
467
|
+
const config = createTestConfig();
|
|
468
|
+
const css = generateCSS([token], config);
|
|
469
|
+
|
|
470
|
+
assert.ok(css.includes('border-color: inherit'));
|
|
471
|
+
assert.ok(!css.includes('var(--c-inherit)'));
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it('generates outline:currentColor without var() wrapping', () => {
|
|
475
|
+
const token = { property: 'outline', value: 'currentColor', attrType: 'visual', raw: 'outline:currentColor' };
|
|
476
|
+
const config = createTestConfig();
|
|
477
|
+
const css = generateCSS([token], config);
|
|
478
|
+
|
|
479
|
+
assert.ok(css.includes('outline-color: currentColor'));
|
|
480
|
+
assert.ok(!css.includes('var(--c-currentColor)'));
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it('generates divide:transparent without var() wrapping', () => {
|
|
484
|
+
const token = { property: 'divide', value: 'transparent', attrType: 'visual', raw: 'divide:transparent' };
|
|
485
|
+
const config = createTestConfig();
|
|
486
|
+
const css = generateCSS([token], config);
|
|
487
|
+
|
|
488
|
+
assert.ok(css.includes('border-color: transparent'));
|
|
489
|
+
assert.ok(!css.includes('var(--c-transparent)'));
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
it('generates from:transparent for gradients without var() wrapping', () => {
|
|
493
|
+
const token = { property: 'from', value: 'transparent', attrType: 'visual', raw: 'from:transparent' };
|
|
494
|
+
const config = createTestConfig();
|
|
495
|
+
const css = generateCSS([token], config);
|
|
496
|
+
|
|
497
|
+
assert.ok(css.includes('--ss-gradient-from: transparent'));
|
|
498
|
+
assert.ok(!css.includes('var(--c-transparent)'));
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
it('generates ring-color:currentColor without var() wrapping', () => {
|
|
502
|
+
const token = { property: 'ring-color', value: 'currentColor', attrType: 'visual', raw: 'ring-color:currentColor' };
|
|
503
|
+
const config = createTestConfig();
|
|
504
|
+
const css = generateCSS([token], config);
|
|
505
|
+
|
|
506
|
+
assert.ok(css.includes('--ss-ring-color: currentColor'));
|
|
507
|
+
assert.ok(!css.includes('var(--c-currentColor)'));
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
});
|
|
511
|
+
|
|
436
512
|
describe('Text', () => {
|
|
437
513
|
|
|
438
514
|
it('generates text color', () => {
|
|
@@ -896,7 +972,14 @@ describe('CSS Generator', () => {
|
|
|
896
972
|
assert.ok(css.includes('transform: rotateY(90deg)'));
|
|
897
973
|
});
|
|
898
974
|
|
|
899
|
-
it('generates rotate-z
|
|
975
|
+
it('generates rotate-z', () => {
|
|
976
|
+
const token = { property: 'rotate-z', value: '45', attrType: 'visual', raw: 'rotate-z:45' };
|
|
977
|
+
const config = createTestConfig();
|
|
978
|
+
const css = generateCSS([token], config);
|
|
979
|
+
assert.ok(css.includes('transform: rotateZ(45deg)'));
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
it('generates rotate (same as rotate-z)', () => {
|
|
900
983
|
const token = { property: 'rotate', value: '180', attrType: 'visual', raw: 'rotate:180' };
|
|
901
984
|
const config = createTestConfig();
|
|
902
985
|
const css = generateCSS([token], config);
|
|
@@ -911,6 +994,120 @@ describe('CSS Generator', () => {
|
|
|
911
994
|
});
|
|
912
995
|
});
|
|
913
996
|
|
|
997
|
+
describe('Skew Transforms', () => {
|
|
998
|
+
|
|
999
|
+
it('generates skew-x', () => {
|
|
1000
|
+
const token = { property: 'skew-x', value: '6', attrType: 'visual', raw: 'skew-x:6' };
|
|
1001
|
+
const config = createTestConfig();
|
|
1002
|
+
const css = generateCSS([token], config);
|
|
1003
|
+
assert.ok(css.includes('transform: skewX(6deg)'));
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
it('generates skew-y', () => {
|
|
1007
|
+
const token = { property: 'skew-y', value: '12', attrType: 'visual', raw: 'skew-y:12' };
|
|
1008
|
+
const config = createTestConfig();
|
|
1009
|
+
const css = generateCSS([token], config);
|
|
1010
|
+
assert.ok(css.includes('transform: skewY(12deg)'));
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
it('generates -skew-x with negative degrees', () => {
|
|
1014
|
+
const token = { property: '-skew-x', value: '6', attrType: 'visual', raw: '-skew-x:6' };
|
|
1015
|
+
const config = createTestConfig();
|
|
1016
|
+
const css = generateCSS([token], config);
|
|
1017
|
+
assert.ok(css.includes('transform: skewX(-6deg)'));
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
it('generates -skew-y with negative degrees', () => {
|
|
1021
|
+
const token = { property: '-skew-y', value: '12', attrType: 'visual', raw: '-skew-y:12' };
|
|
1022
|
+
const config = createTestConfig();
|
|
1023
|
+
const css = generateCSS([token], config);
|
|
1024
|
+
assert.ok(css.includes('transform: skewY(-12deg)'));
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
describe('Translate Transforms', () => {
|
|
1029
|
+
|
|
1030
|
+
it('generates translate-x with scale value', () => {
|
|
1031
|
+
const token = { property: 'translate-x', value: 'medium', attrType: 'visual', raw: 'translate-x:medium' };
|
|
1032
|
+
const config = createTestConfig();
|
|
1033
|
+
const css = generateCSS([token], config);
|
|
1034
|
+
assert.ok(css.includes('transform: translateX(var(--s-medium))'));
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
it('generates translate-x with preset (1/2)', () => {
|
|
1038
|
+
const token = { property: 'translate-x', value: '1/2', attrType: 'visual', raw: 'translate-x:1/2' };
|
|
1039
|
+
const config = createTestConfig();
|
|
1040
|
+
const css = generateCSS([token], config);
|
|
1041
|
+
assert.ok(css.includes('transform: translateX(50%)'));
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
it('generates translate-y with scale value', () => {
|
|
1045
|
+
const token = { property: 'translate-y', value: 'big', attrType: 'visual', raw: 'translate-y:big' };
|
|
1046
|
+
const config = createTestConfig();
|
|
1047
|
+
const css = generateCSS([token], config);
|
|
1048
|
+
assert.ok(css.includes('transform: translateY(var(--s-big))'));
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
it('generates translate-y with preset (full)', () => {
|
|
1052
|
+
const token = { property: 'translate-y', value: 'full', attrType: 'visual', raw: 'translate-y:full' };
|
|
1053
|
+
const config = createTestConfig();
|
|
1054
|
+
const css = generateCSS([token], config);
|
|
1055
|
+
assert.ok(css.includes('transform: translateY(100%)'));
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
it('generates translate-x with negative half', () => {
|
|
1059
|
+
const token = { property: 'translate-x', value: '-half', attrType: 'visual', raw: 'translate-x:-half' };
|
|
1060
|
+
const config = createTestConfig();
|
|
1061
|
+
const css = generateCSS([token], config);
|
|
1062
|
+
assert.ok(css.includes('transform: translateX(-50%)'));
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
it('generates translate-x with negative full', () => {
|
|
1066
|
+
const token = { property: 'translate-x', value: '-full', attrType: 'visual', raw: 'translate-x:-full' };
|
|
1067
|
+
const config = createTestConfig();
|
|
1068
|
+
const css = generateCSS([token], config);
|
|
1069
|
+
assert.ok(css.includes('transform: translateX(-100%)'));
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
it('generates translate-y with negative third', () => {
|
|
1073
|
+
const token = { property: 'translate-y', value: '-third', attrType: 'visual', raw: 'translate-y:-third' };
|
|
1074
|
+
const config = createTestConfig();
|
|
1075
|
+
const css = generateCSS([token], config);
|
|
1076
|
+
assert.ok(css.includes('transform: translateY(-33.333333%)'));
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
it('generates translate-y with negative quarter-3x', () => {
|
|
1080
|
+
const token = { property: 'translate-y', value: '-quarter-3x', attrType: 'visual', raw: 'translate-y:-quarter-3x' };
|
|
1081
|
+
const config = createTestConfig();
|
|
1082
|
+
const css = generateCSS([token], config);
|
|
1083
|
+
assert.ok(css.includes('transform: translateY(-75%)'));
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
describe('Scale Transforms', () => {
|
|
1088
|
+
|
|
1089
|
+
it('generates scale with percentage value', () => {
|
|
1090
|
+
const token = { property: 'scale', value: '75', attrType: 'visual', raw: 'scale:75' };
|
|
1091
|
+
const config = createTestConfig();
|
|
1092
|
+
const css = generateCSS([token], config);
|
|
1093
|
+
assert.ok(css.includes('transform: scale(0.75)'));
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
it('generates scale-x with percentage value', () => {
|
|
1097
|
+
const token = { property: 'scale-x', value: '50', attrType: 'visual', raw: 'scale-x:50' };
|
|
1098
|
+
const config = createTestConfig();
|
|
1099
|
+
const css = generateCSS([token], config);
|
|
1100
|
+
assert.ok(css.includes('transform: scaleX(0.5)'));
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
it('generates scale-y with percentage value', () => {
|
|
1104
|
+
const token = { property: 'scale-y', value: '125', attrType: 'visual', raw: 'scale-y:125' };
|
|
1105
|
+
const config = createTestConfig();
|
|
1106
|
+
const css = generateCSS([token], config);
|
|
1107
|
+
assert.ok(css.includes('transform: scaleY(1.25)'));
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
|
|
914
1111
|
describe('3D Translation (Translate Z)', () => {
|
|
915
1112
|
|
|
916
1113
|
it('generates translate-z with arbitrary px', () => {
|
|
@@ -980,4 +1177,1224 @@ describe('CSS Generator', () => {
|
|
|
980
1177
|
});
|
|
981
1178
|
});
|
|
982
1179
|
|
|
1180
|
+
describe('Animation Utilities', () => {
|
|
1181
|
+
|
|
1182
|
+
it('generates animation-delay with scale value', () => {
|
|
1183
|
+
const token = { property: 'animation-delay', value: 'slow', attrType: 'visual', raw: 'animation-delay:slow' };
|
|
1184
|
+
const config = createTestConfig();
|
|
1185
|
+
const css = generateCSS([token], config);
|
|
1186
|
+
assert.ok(css.includes('animation-delay: 300ms'));
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
it('generates animation-delay with arbitrary value', () => {
|
|
1190
|
+
const token = { property: 'animation-delay', value: '500ms', isArbitrary: true, attrType: 'visual', raw: 'animation-delay:[500ms]' };
|
|
1191
|
+
const config = createTestConfig();
|
|
1192
|
+
const css = generateCSS([token], config);
|
|
1193
|
+
assert.ok(css.includes('animation-delay: 500ms'));
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
it('generates animation-iteration-count', () => {
|
|
1197
|
+
const token = { property: 'animation-iteration', value: 'infinite', attrType: 'visual', raw: 'animation-iteration:infinite' };
|
|
1198
|
+
const config = createTestConfig();
|
|
1199
|
+
const css = generateCSS([token], config);
|
|
1200
|
+
assert.ok(css.includes('animation-iteration-count: infinite'));
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
it('generates animation-direction', () => {
|
|
1204
|
+
const token = { property: 'animation-direction', value: 'reverse', attrType: 'visual', raw: 'animation-direction:reverse' };
|
|
1205
|
+
const config = createTestConfig();
|
|
1206
|
+
const css = generateCSS([token], config);
|
|
1207
|
+
assert.ok(css.includes('animation-direction: reverse'));
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
it('generates animation-fill-mode', () => {
|
|
1211
|
+
const token = { property: 'animation-fill', value: 'forwards', attrType: 'visual', raw: 'animation-fill:forwards' };
|
|
1212
|
+
const config = createTestConfig();
|
|
1213
|
+
const css = generateCSS([token], config);
|
|
1214
|
+
assert.ok(css.includes('animation-fill-mode: forwards'));
|
|
1215
|
+
});
|
|
1216
|
+
|
|
1217
|
+
it('generates animation-play-state', () => {
|
|
1218
|
+
const token = { property: 'animation-play', value: 'paused', attrType: 'visual', raw: 'animation-play:paused' };
|
|
1219
|
+
const config = createTestConfig();
|
|
1220
|
+
const css = generateCSS([token], config);
|
|
1221
|
+
assert.ok(css.includes('animation-play-state: paused'));
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
it('generates animate preset (spin)', () => {
|
|
1225
|
+
const token = { property: 'animate', value: 'spin', attrType: 'visual', raw: 'animate:spin' };
|
|
1226
|
+
const config = createTestConfig();
|
|
1227
|
+
const css = generateCSS([token], config);
|
|
1228
|
+
assert.ok(css.includes('animation: spin 1s linear infinite'));
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
it('generates animation-duration with scale value', () => {
|
|
1232
|
+
const token = { property: 'animation-duration', value: 'slow', attrType: 'visual', raw: 'animation-duration:slow' };
|
|
1233
|
+
const config = createTestConfig();
|
|
1234
|
+
const css = generateCSS([token], config);
|
|
1235
|
+
assert.ok(css.includes('animation-duration: 300ms'));
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
it('generates transition-delay with scale value', () => {
|
|
1239
|
+
const token = { property: 'delay', value: 'fast', attrType: 'visual', raw: 'delay:fast' };
|
|
1240
|
+
const config = createTestConfig();
|
|
1241
|
+
const css = generateCSS([token], config);
|
|
1242
|
+
assert.ok(css.includes('transition-delay: 150ms'));
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
it('generates transition-behavior', () => {
|
|
1246
|
+
const token = { property: 'transition-behavior', value: 'allow-discrete', attrType: 'visual', raw: 'transition-behavior:allow-discrete' };
|
|
1247
|
+
const config = createTestConfig();
|
|
1248
|
+
const css = generateCSS([token], config);
|
|
1249
|
+
assert.ok(css.includes('transition-behavior: allow-discrete'));
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
describe('Transition Utilities', () => {
|
|
1255
|
+
|
|
1256
|
+
it('generates transition-none', () => {
|
|
1257
|
+
const token = { property: 'transition-none', value: '', attrType: 'visual', raw: 'transition-none' };
|
|
1258
|
+
const config = createTestConfig();
|
|
1259
|
+
const css = generateCSS([token], config);
|
|
1260
|
+
assert.ok(css.includes('transition-property: none'));
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
it('generates duration with scale value', () => {
|
|
1264
|
+
const token = { property: 'duration', value: 'slow', attrType: 'visual', raw: 'duration:slow' };
|
|
1265
|
+
const config = createTestConfig();
|
|
1266
|
+
const css = generateCSS([token], config);
|
|
1267
|
+
assert.ok(css.includes('transition-duration: 300ms'));
|
|
1268
|
+
});
|
|
1269
|
+
|
|
1270
|
+
it('generates ease with preset value', () => {
|
|
1271
|
+
const token = { property: 'ease', value: 'in', attrType: 'visual', raw: 'ease:in' };
|
|
1272
|
+
const config = createTestConfig();
|
|
1273
|
+
const css = generateCSS([token], config);
|
|
1274
|
+
assert.ok(css.includes('transition-timing-function: cubic-bezier(0.4, 0, 1, 1)'));
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
it('generates ease (linear)', () => {
|
|
1278
|
+
const token = { property: 'ease', value: 'linear', attrType: 'visual', raw: 'ease:linear' };
|
|
1279
|
+
const config = createTestConfig();
|
|
1280
|
+
const css = generateCSS([token], config);
|
|
1281
|
+
assert.ok(css.includes('transition-timing-function: linear'));
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
it('generates transition preset', () => {
|
|
1285
|
+
const token = { property: 'transition', value: 'colors', attrType: 'visual', raw: 'transition:colors' };
|
|
1286
|
+
const config = createTestConfig();
|
|
1287
|
+
const css = generateCSS([token], config);
|
|
1288
|
+
assert.ok(css.includes('transition-property:'));
|
|
1289
|
+
assert.ok(css.includes('transition-duration: 150ms'));
|
|
1290
|
+
});
|
|
1291
|
+
|
|
1292
|
+
});
|
|
1293
|
+
|
|
1294
|
+
describe('Backdrop Filter Utilities', () => {
|
|
1295
|
+
|
|
1296
|
+
it('generates backdrop-saturate', () => {
|
|
1297
|
+
const token = { property: 'backdrop-saturate', value: 'vivid', attrType: 'visual', raw: 'backdrop-saturate:vivid' };
|
|
1298
|
+
const config = createTestConfig();
|
|
1299
|
+
const css = generateCSS([token], config);
|
|
1300
|
+
assert.ok(css.includes('backdrop-filter: saturate(2)'));
|
|
1301
|
+
});
|
|
1302
|
+
|
|
1303
|
+
it('generates backdrop-sepia', () => {
|
|
1304
|
+
const token = { property: 'backdrop-sepia', value: 'full', attrType: 'visual', raw: 'backdrop-sepia:full' };
|
|
1305
|
+
const config = createTestConfig();
|
|
1306
|
+
const css = generateCSS([token], config);
|
|
1307
|
+
assert.ok(css.includes('backdrop-filter: sepia(100%)'));
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1310
|
+
it('generates backdrop-hue-rotate', () => {
|
|
1311
|
+
const token = { property: 'backdrop-hue-rotate', value: '90', attrType: 'visual', raw: 'backdrop-hue-rotate:90' };
|
|
1312
|
+
const config = createTestConfig();
|
|
1313
|
+
const css = generateCSS([token], config);
|
|
1314
|
+
assert.ok(css.includes('backdrop-filter: hue-rotate(90deg)'));
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
it('generates backdrop-invert', () => {
|
|
1318
|
+
const token = { property: 'backdrop-invert', value: 'full', attrType: 'visual', raw: 'backdrop-invert:full' };
|
|
1319
|
+
const config = createTestConfig();
|
|
1320
|
+
const css = generateCSS([token], config);
|
|
1321
|
+
assert.ok(css.includes('backdrop-filter: invert(100%)'));
|
|
1322
|
+
});
|
|
1323
|
+
|
|
1324
|
+
it('generates backdrop-opacity', () => {
|
|
1325
|
+
const token = { property: 'backdrop-opacity', value: 'half', attrType: 'visual', raw: 'backdrop-opacity:half' };
|
|
1326
|
+
const config = createTestConfig();
|
|
1327
|
+
const css = generateCSS([token], config);
|
|
1328
|
+
assert.ok(css.includes('backdrop-filter: opacity(0.5)'));
|
|
1329
|
+
});
|
|
1330
|
+
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
describe('Filter Utilities', () => {
|
|
1334
|
+
|
|
1335
|
+
it('generates brightness', () => {
|
|
1336
|
+
const token = { property: 'brightness', value: 'vivid', attrType: 'visual', raw: 'brightness:vivid' };
|
|
1337
|
+
const config = createTestConfig();
|
|
1338
|
+
const css = generateCSS([token], config);
|
|
1339
|
+
assert.ok(css.includes('filter: brightness(1.5)'));
|
|
1340
|
+
});
|
|
1341
|
+
|
|
1342
|
+
it('generates contrast', () => {
|
|
1343
|
+
const token = { property: 'contrast', value: 'high', attrType: 'visual', raw: 'contrast:high' };
|
|
1344
|
+
const config = createTestConfig();
|
|
1345
|
+
const css = generateCSS([token], config);
|
|
1346
|
+
assert.ok(css.includes('filter: contrast(1.25)'));
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
it('generates drop-shadow', () => {
|
|
1350
|
+
const token = { property: 'drop-shadow', value: 'medium', attrType: 'visual', raw: 'drop-shadow:medium' };
|
|
1351
|
+
const config = createTestConfig();
|
|
1352
|
+
const css = generateCSS([token], config);
|
|
1353
|
+
assert.ok(css.includes('filter: drop-shadow('));
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
it('generates grayscale', () => {
|
|
1357
|
+
const token = { property: 'grayscale', value: 'full', attrType: 'visual', raw: 'grayscale:full' };
|
|
1358
|
+
const config = createTestConfig();
|
|
1359
|
+
const css = generateCSS([token], config);
|
|
1360
|
+
assert.ok(css.includes('filter: grayscale(100%)'));
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
it('generates hue-rotate', () => {
|
|
1364
|
+
const token = { property: 'hue-rotate', value: '180', attrType: 'visual', raw: 'hue-rotate:180' };
|
|
1365
|
+
const config = createTestConfig();
|
|
1366
|
+
const css = generateCSS([token], config);
|
|
1367
|
+
assert.ok(css.includes('filter: hue-rotate(180deg)'));
|
|
1368
|
+
});
|
|
1369
|
+
|
|
1370
|
+
it('generates invert', () => {
|
|
1371
|
+
const token = { property: 'invert', value: 'full', attrType: 'visual', raw: 'invert:full' };
|
|
1372
|
+
const config = createTestConfig();
|
|
1373
|
+
const css = generateCSS([token], config);
|
|
1374
|
+
assert.ok(css.includes('filter: invert(100%)'));
|
|
1375
|
+
});
|
|
1376
|
+
|
|
1377
|
+
it('generates saturate', () => {
|
|
1378
|
+
const token = { property: 'saturate', value: 'vivid', attrType: 'visual', raw: 'saturate:vivid' };
|
|
1379
|
+
const config = createTestConfig();
|
|
1380
|
+
const css = generateCSS([token], config);
|
|
1381
|
+
assert.ok(css.includes('filter: saturate(2)'));
|
|
1382
|
+
});
|
|
1383
|
+
|
|
1384
|
+
it('generates sepia', () => {
|
|
1385
|
+
const token = { property: 'sepia', value: 'full', attrType: 'visual', raw: 'sepia:full' };
|
|
1386
|
+
const config = createTestConfig();
|
|
1387
|
+
const css = generateCSS([token], config);
|
|
1388
|
+
assert.ok(css.includes('filter: sepia(100%)'));
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1391
|
+
it('generates backdrop-blur', () => {
|
|
1392
|
+
const token = { property: 'backdrop-blur', value: 'big', attrType: 'visual', raw: 'backdrop-blur:big' };
|
|
1393
|
+
const config = createTestConfig();
|
|
1394
|
+
const css = generateCSS([token], config);
|
|
1395
|
+
assert.ok(css.includes('backdrop-filter: blur(12px)'));
|
|
1396
|
+
});
|
|
1397
|
+
|
|
1398
|
+
it('generates backdrop-brightness', () => {
|
|
1399
|
+
const token = { property: 'backdrop-brightness', value: 'bright', attrType: 'visual', raw: 'backdrop-brightness:bright' };
|
|
1400
|
+
const config = createTestConfig();
|
|
1401
|
+
const css = generateCSS([token], config);
|
|
1402
|
+
assert.ok(css.includes('backdrop-filter: brightness(1.25)'));
|
|
1403
|
+
});
|
|
1404
|
+
|
|
1405
|
+
it('generates backdrop-contrast', () => {
|
|
1406
|
+
const token = { property: 'backdrop-contrast', value: 'max', attrType: 'visual', raw: 'backdrop-contrast:max' };
|
|
1407
|
+
const config = createTestConfig();
|
|
1408
|
+
const css = generateCSS([token], config);
|
|
1409
|
+
assert.ok(css.includes('backdrop-filter: contrast(1.5)'));
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
it('generates backdrop-grayscale', () => {
|
|
1413
|
+
const token = { property: 'backdrop-grayscale', value: 'partial', attrType: 'visual', raw: 'backdrop-grayscale:partial' };
|
|
1414
|
+
const config = createTestConfig();
|
|
1415
|
+
const css = generateCSS([token], config);
|
|
1416
|
+
assert.ok(css.includes('backdrop-filter: grayscale(50%)'));
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
it('generates blur filter', () => {
|
|
1420
|
+
const token = { property: 'blur', value: 'big', attrType: 'visual', raw: 'blur:big' };
|
|
1421
|
+
const config = createTestConfig();
|
|
1422
|
+
const css = generateCSS([token], config);
|
|
1423
|
+
assert.ok(css.includes('filter: blur(12px)'));
|
|
1424
|
+
});
|
|
1425
|
+
|
|
1426
|
+
it('generates mask-size', () => {
|
|
1427
|
+
const token = { property: 'mask-size', value: 'cover', attrType: 'visual', raw: 'mask-size:cover' };
|
|
1428
|
+
const config = createTestConfig();
|
|
1429
|
+
const css = generateCSS([token], config);
|
|
1430
|
+
assert.ok(css.includes('mask-size: cover'));
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
it('generates mask-type', () => {
|
|
1434
|
+
const token = { property: 'mask-type', value: 'luminance', attrType: 'visual', raw: 'mask-type:luminance' };
|
|
1435
|
+
const config = createTestConfig();
|
|
1436
|
+
const css = generateCSS([token], config);
|
|
1437
|
+
assert.ok(css.includes('mask-type: luminance'));
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
it('generates content', () => {
|
|
1441
|
+
const token = { property: 'content', value: 'hello', attrType: 'visual', raw: 'content:hello' };
|
|
1442
|
+
const config = createTestConfig();
|
|
1443
|
+
const css = generateCSS([token], config);
|
|
1444
|
+
assert.ok(css.includes('content: '));
|
|
1445
|
+
});
|
|
1446
|
+
|
|
1447
|
+
it('generates mask-origin', () => {
|
|
1448
|
+
const token = { property: 'mask-origin', value: 'border', attrType: 'visual', raw: 'mask-origin:border' };
|
|
1449
|
+
const config = createTestConfig();
|
|
1450
|
+
const css = generateCSS([token], config);
|
|
1451
|
+
assert.ok(css.includes('mask-origin: border-box'));
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1454
|
+
it('generates mask-position', () => {
|
|
1455
|
+
const token = { property: 'mask-position', value: 'top-right', attrType: 'visual', raw: 'mask-position:top-right' };
|
|
1456
|
+
const config = createTestConfig();
|
|
1457
|
+
const css = generateCSS([token], config);
|
|
1458
|
+
assert.ok(css.includes('mask-position: top right'));
|
|
1459
|
+
});
|
|
1460
|
+
|
|
1461
|
+
it('generates mask-repeat', () => {
|
|
1462
|
+
const token = { property: 'mask-repeat', value: 'no-repeat', attrType: 'visual', raw: 'mask-repeat:no-repeat' };
|
|
1463
|
+
const config = createTestConfig();
|
|
1464
|
+
const css = generateCSS([token], config);
|
|
1465
|
+
assert.ok(css.includes('mask-repeat: no-repeat'));
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
it('generates mask-clip', () => {
|
|
1469
|
+
const token = { property: 'mask-clip', value: 'text', attrType: 'visual', raw: 'mask-clip:text' };
|
|
1470
|
+
const config = createTestConfig();
|
|
1471
|
+
const css = generateCSS([token], config);
|
|
1472
|
+
assert.ok(css.includes('mask-clip: text'));
|
|
1473
|
+
});
|
|
1474
|
+
|
|
1475
|
+
it('generates mask-composite', () => {
|
|
1476
|
+
const token = { property: 'mask-composite', value: 'add', attrType: 'visual', raw: 'mask-composite:add' };
|
|
1477
|
+
const config = createTestConfig();
|
|
1478
|
+
const css = generateCSS([token], config);
|
|
1479
|
+
assert.ok(css.includes('mask-composite: add'));
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1482
|
+
it('generates mask-image', () => {
|
|
1483
|
+
const token = { property: 'mask-image', value: 'path/to/mask.png', attrType: 'visual', raw: 'mask-image:path/to/mask.png' };
|
|
1484
|
+
const config = createTestConfig();
|
|
1485
|
+
const css = generateCSS([token], config);
|
|
1486
|
+
assert.ok(css.includes('mask-image: url('));
|
|
1487
|
+
});
|
|
1488
|
+
|
|
1489
|
+
it('generates mask-mode', () => {
|
|
1490
|
+
const token = { property: 'mask-mode', value: 'luminance', attrType: 'visual', raw: 'mask-mode:luminance' };
|
|
1491
|
+
const config = createTestConfig();
|
|
1492
|
+
const css = generateCSS([token], config);
|
|
1493
|
+
assert.ok(css.includes('mask-mode: luminance'));
|
|
1494
|
+
});
|
|
1495
|
+
|
|
1496
|
+
it('generates outline-style', () => {
|
|
1497
|
+
const token = { property: 'outline-style', value: 'dashed', attrType: 'visual', raw: 'outline-style:dashed' };
|
|
1498
|
+
const config = createTestConfig();
|
|
1499
|
+
const css = generateCSS([token], config);
|
|
1500
|
+
assert.ok(css.includes('outline-style: dashed'));
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
it('generates outline-offset', () => {
|
|
1504
|
+
const token = { property: 'outline-offset', value: 'medium', attrType: 'visual', raw: 'outline-offset:medium' };
|
|
1505
|
+
const config = createTestConfig();
|
|
1506
|
+
const css = generateCSS([token], config);
|
|
1507
|
+
assert.ok(css.includes('outline-offset: var(--s-medium)'));
|
|
1508
|
+
});
|
|
1509
|
+
|
|
1510
|
+
it('generates mix-blend', () => {
|
|
1511
|
+
const token = { property: 'mix-blend', value: 'overlay', attrType: 'visual', raw: 'mix-blend:overlay' };
|
|
1512
|
+
const config = createTestConfig();
|
|
1513
|
+
const css = generateCSS([token], config);
|
|
1514
|
+
assert.ok(css.includes('mix-blend-mode: overlay'));
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
it('generates outline color', () => {
|
|
1518
|
+
const token = { property: 'outline', value: 'primary', attrType: 'visual', raw: 'outline:primary' };
|
|
1519
|
+
const config = createTestConfig();
|
|
1520
|
+
const css = generateCSS([token], config);
|
|
1521
|
+
assert.ok(css.includes('outline-color: var(--c-primary)'));
|
|
1522
|
+
});
|
|
1523
|
+
|
|
1524
|
+
it('generates divide-x color', () => {
|
|
1525
|
+
const token = { property: 'divide-x', value: 'secondary', attrType: 'visual', raw: 'divide-x:secondary' };
|
|
1526
|
+
const config = createTestConfig();
|
|
1527
|
+
const css = generateCSS([token], config);
|
|
1528
|
+
assert.ok(css.includes('border-left-color: var(--c-secondary)'));
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
it('generates divide-x reverse', () => {
|
|
1532
|
+
const token = { property: 'divide-x', value: 'reverse', attrType: 'visual', raw: 'divide-x:reverse' };
|
|
1533
|
+
const config = createTestConfig();
|
|
1534
|
+
const css = generateCSS([token], config);
|
|
1535
|
+
assert.ok(css.includes('--ss-divide-x-reverse: 1'));
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
it('generates divide-y color', () => {
|
|
1539
|
+
const token = { property: 'divide-y', value: 'primary', attrType: 'visual', raw: 'divide-y:primary' };
|
|
1540
|
+
const config = createTestConfig();
|
|
1541
|
+
const css = generateCSS([token], config);
|
|
1542
|
+
assert.ok(css.includes('border-top-color: var(--c-primary)'));
|
|
1543
|
+
});
|
|
1544
|
+
|
|
1545
|
+
it('generates divide-y reverse', () => {
|
|
1546
|
+
const token = { property: 'divide-y', value: 'reverse', attrType: 'visual', raw: 'divide-y:reverse' };
|
|
1547
|
+
const config = createTestConfig();
|
|
1548
|
+
const css = generateCSS([token], config);
|
|
1549
|
+
assert.ok(css.includes('--ss-divide-y-reverse: 1'));
|
|
1550
|
+
});
|
|
1551
|
+
|
|
1552
|
+
it('generates outline-w', () => {
|
|
1553
|
+
const token = { property: 'outline-w', value: 'medium', attrType: 'visual', raw: 'outline-w:medium' };
|
|
1554
|
+
const config = createTestConfig();
|
|
1555
|
+
const css = generateCSS([token], config);
|
|
1556
|
+
assert.ok(css.includes('outline-width: var(--s-medium)'));
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
describe('Border Directional Utilities', () => {
|
|
1562
|
+
|
|
1563
|
+
it('generates border color', () => {
|
|
1564
|
+
const token = { property: 'border', value: 'primary', attrType: 'visual', raw: 'border:primary' };
|
|
1565
|
+
const config = createTestConfig();
|
|
1566
|
+
const css = generateCSS([token], config);
|
|
1567
|
+
assert.ok(css.includes('border-color: var(--c-primary)'));
|
|
1568
|
+
});
|
|
1569
|
+
|
|
1570
|
+
it('generates border-t color', () => {
|
|
1571
|
+
const token = { property: 'border-t', value: 'secondary', attrType: 'visual', raw: 'border-t:secondary' };
|
|
1572
|
+
const config = createTestConfig();
|
|
1573
|
+
const css = generateCSS([token], config);
|
|
1574
|
+
assert.ok(css.includes('border-top-color: var(--c-secondary)'));
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
it('generates border-b color', () => {
|
|
1578
|
+
const token = { property: 'border-b', value: 'accent', attrType: 'visual', raw: 'border-b:accent' };
|
|
1579
|
+
const config = createTestConfig();
|
|
1580
|
+
const css = generateCSS([token], config);
|
|
1581
|
+
assert.ok(css.includes('border-bottom-color: var(--c-accent)'));
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
it('generates border-l color', () => {
|
|
1585
|
+
const token = { property: 'border-l', value: 'primary', attrType: 'visual', raw: 'border-l:primary' };
|
|
1586
|
+
const config = createTestConfig();
|
|
1587
|
+
const css = generateCSS([token], config);
|
|
1588
|
+
assert.ok(css.includes('border-left-color: var(--c-primary)'));
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
it('generates border-r color', () => {
|
|
1592
|
+
const token = { property: 'border-r', value: 'secondary', attrType: 'visual', raw: 'border-r:secondary' };
|
|
1593
|
+
const config = createTestConfig();
|
|
1594
|
+
const css = generateCSS([token], config);
|
|
1595
|
+
assert.ok(css.includes('border-right-color: var(--c-secondary)'));
|
|
1596
|
+
});
|
|
1597
|
+
|
|
1598
|
+
it('generates border-x color', () => {
|
|
1599
|
+
const token = { property: 'border-x', value: 'primary', attrType: 'visual', raw: 'border-x:primary' };
|
|
1600
|
+
const config = createTestConfig();
|
|
1601
|
+
const css = generateCSS([token], config);
|
|
1602
|
+
assert.ok(css.includes('border-left-color: var(--c-primary)'));
|
|
1603
|
+
assert.ok(css.includes('border-right-color: var(--c-primary)'));
|
|
1604
|
+
});
|
|
1605
|
+
|
|
1606
|
+
it('generates border-y color', () => {
|
|
1607
|
+
const token = { property: 'border-y', value: 'secondary', attrType: 'visual', raw: 'border-y:secondary' };
|
|
1608
|
+
const config = createTestConfig();
|
|
1609
|
+
const css = generateCSS([token], config);
|
|
1610
|
+
assert.ok(css.includes('border-top-color: var(--c-secondary)'));
|
|
1611
|
+
assert.ok(css.includes('border-bottom-color: var(--c-secondary)'));
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
it('generates border-w', () => {
|
|
1615
|
+
const token = { property: 'border-w', value: 'medium', attrType: 'visual', raw: 'border-w:medium' };
|
|
1616
|
+
const config = createTestConfig();
|
|
1617
|
+
const css = generateCSS([token], config);
|
|
1618
|
+
assert.ok(css.includes('border-width: var(--s-medium)'));
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
it('generates border-t-w', () => {
|
|
1622
|
+
const token = { property: 'border-t-w', value: 'small', attrType: 'visual', raw: 'border-t-w:small' };
|
|
1623
|
+
const config = createTestConfig();
|
|
1624
|
+
const css = generateCSS([token], config);
|
|
1625
|
+
assert.ok(css.includes('border-top-width: var(--s-small)'));
|
|
1626
|
+
});
|
|
1627
|
+
|
|
1628
|
+
it('generates border-b-w', () => {
|
|
1629
|
+
const token = { property: 'border-b-w', value: 'medium', attrType: 'visual', raw: 'border-b-w:medium' };
|
|
1630
|
+
const config = createTestConfig();
|
|
1631
|
+
const css = generateCSS([token], config);
|
|
1632
|
+
assert.ok(css.includes('border-bottom-width: var(--s-medium)'));
|
|
1633
|
+
});
|
|
1634
|
+
|
|
1635
|
+
it('generates border-l-w', () => {
|
|
1636
|
+
const token = { property: 'border-l-w', value: 'big', attrType: 'visual', raw: 'border-l-w:big' };
|
|
1637
|
+
const config = createTestConfig();
|
|
1638
|
+
const css = generateCSS([token], config);
|
|
1639
|
+
assert.ok(css.includes('border-left-width: var(--s-big)'));
|
|
1640
|
+
});
|
|
1641
|
+
|
|
1642
|
+
it('generates border-r-w', () => {
|
|
1643
|
+
const token = { property: 'border-r-w', value: 'small', attrType: 'visual', raw: 'border-r-w:small' };
|
|
1644
|
+
const config = createTestConfig();
|
|
1645
|
+
const css = generateCSS([token], config);
|
|
1646
|
+
assert.ok(css.includes('border-right-width: var(--s-small)'));
|
|
1647
|
+
});
|
|
1648
|
+
|
|
1649
|
+
it('generates border-x-w', () => {
|
|
1650
|
+
const token = { property: 'border-x-w', value: 'medium', attrType: 'visual', raw: 'border-x-w:medium' };
|
|
1651
|
+
const config = createTestConfig();
|
|
1652
|
+
const css = generateCSS([token], config);
|
|
1653
|
+
assert.ok(css.includes('border-left-width: var(--s-medium)'));
|
|
1654
|
+
assert.ok(css.includes('border-right-width: var(--s-medium)'));
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
it('generates border-y-w', () => {
|
|
1658
|
+
const token = { property: 'border-y-w', value: 'small', attrType: 'visual', raw: 'border-y-w:small' };
|
|
1659
|
+
const config = createTestConfig();
|
|
1660
|
+
const css = generateCSS([token], config);
|
|
1661
|
+
assert.ok(css.includes('border-top-width: var(--s-small)'));
|
|
1662
|
+
assert.ok(css.includes('border-bottom-width: var(--s-small)'));
|
|
1663
|
+
});
|
|
1664
|
+
|
|
1665
|
+
it('generates border-style', () => {
|
|
1666
|
+
const token = { property: 'border-style', value: 'dashed', attrType: 'visual', raw: 'border-style:dashed' };
|
|
1667
|
+
const config = createTestConfig();
|
|
1668
|
+
const css = generateCSS([token], config);
|
|
1669
|
+
assert.ok(css.includes('border-style: dashed'));
|
|
1670
|
+
});
|
|
1671
|
+
|
|
1672
|
+
});
|
|
1673
|
+
|
|
1674
|
+
describe('Text Decoration Utilities', () => {
|
|
1675
|
+
|
|
1676
|
+
it('generates decoration-thickness', () => {
|
|
1677
|
+
const token = { property: 'decoration-thickness', value: '2', attrType: 'visual', raw: 'decoration-thickness:2' };
|
|
1678
|
+
const config = createTestConfig();
|
|
1679
|
+
const css = generateCSS([token], config);
|
|
1680
|
+
assert.ok(css.includes('text-decoration-thickness: 2px'));
|
|
1681
|
+
});
|
|
1682
|
+
|
|
1683
|
+
it('generates underline-offset', () => {
|
|
1684
|
+
const token = { property: 'underline-offset', value: '4', attrType: 'visual', raw: 'underline-offset:4' };
|
|
1685
|
+
const config = createTestConfig();
|
|
1686
|
+
const css = generateCSS([token], config);
|
|
1687
|
+
assert.ok(css.includes('text-underline-offset: 4px'));
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
it('generates text-indent', () => {
|
|
1691
|
+
const token = { property: 'indent', value: 'medium', attrType: 'visual', raw: 'indent:medium' };
|
|
1692
|
+
const config = createTestConfig();
|
|
1693
|
+
const css = generateCSS([token], config);
|
|
1694
|
+
assert.ok(css.includes('text-indent: var(--s-medium)'));
|
|
1695
|
+
});
|
|
1696
|
+
|
|
1697
|
+
it('generates leading (line-height)', () => {
|
|
1698
|
+
const token = { property: 'leading', value: 'relaxed', attrType: 'visual', raw: 'leading:relaxed' };
|
|
1699
|
+
const config = createTestConfig();
|
|
1700
|
+
const css = generateCSS([token], config);
|
|
1701
|
+
assert.ok(css.includes('line-height: 1.625'));
|
|
1702
|
+
});
|
|
1703
|
+
|
|
1704
|
+
it('generates line-clamp', () => {
|
|
1705
|
+
const token = { property: 'line-clamp', value: '3', attrType: 'visual', raw: 'line-clamp:3' };
|
|
1706
|
+
const config = createTestConfig();
|
|
1707
|
+
const css = generateCSS([token], config);
|
|
1708
|
+
assert.ok(css.includes('-webkit-line-clamp: 3'));
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
it('generates decoration color', () => {
|
|
1712
|
+
const token = { property: 'decoration', value: 'accent', attrType: 'visual', raw: 'decoration:accent' };
|
|
1713
|
+
const config = createTestConfig();
|
|
1714
|
+
const css = generateCSS([token], config);
|
|
1715
|
+
assert.ok(css.includes('text-decoration-color: var(--c-accent)'));
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
});
|
|
1719
|
+
|
|
1720
|
+
describe('Typography Utilities', () => {
|
|
1721
|
+
|
|
1722
|
+
it('generates tracking (letter-spacing)', () => {
|
|
1723
|
+
const token = { property: 'tracking', value: 'wide', attrType: 'visual', raw: 'tracking:wide' };
|
|
1724
|
+
const config = createTestConfig();
|
|
1725
|
+
const css = generateCSS([token], config);
|
|
1726
|
+
assert.ok(css.includes('letter-spacing: 0.025em'));
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
it('generates font with tw- prefix', () => {
|
|
1730
|
+
const token = { property: 'font', value: 'tw-bold', attrType: 'visual', raw: 'font:tw-bold' };
|
|
1731
|
+
const config = createTestConfig();
|
|
1732
|
+
const css = generateCSS([token], config);
|
|
1733
|
+
assert.ok(css.includes('font-weight: var(--tw-font-bold)'));
|
|
1734
|
+
});
|
|
1735
|
+
|
|
1736
|
+
it('generates font with arbitrary value', () => {
|
|
1737
|
+
const token = { property: 'font', value: '600', attrType: 'visual', isArbitrary: true, raw: 'font:[600]' };
|
|
1738
|
+
const config = createTestConfig();
|
|
1739
|
+
const css = generateCSS([token], config);
|
|
1740
|
+
assert.ok(css.includes('font-weight: 600'));
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
it('generates text-size with tw- prefix', () => {
|
|
1744
|
+
const token = { property: 'text-size', value: 'tw-lg', attrType: 'visual', raw: 'text-size:tw-lg' };
|
|
1745
|
+
const config = createTestConfig();
|
|
1746
|
+
const css = generateCSS([token], config);
|
|
1747
|
+
assert.ok(css.includes('font-size: var(--tw-text-lg)'));
|
|
1748
|
+
assert.ok(css.includes('line-height: var(--tw-leading-lg)'));
|
|
1749
|
+
});
|
|
1750
|
+
|
|
1751
|
+
it('generates text-size with arbitrary value', () => {
|
|
1752
|
+
const token = { property: 'text-size', value: '18px', attrType: 'visual', isArbitrary: true, raw: 'text-size:[18px]' };
|
|
1753
|
+
const config = createTestConfig();
|
|
1754
|
+
const css = generateCSS([token], config);
|
|
1755
|
+
assert.ok(css.includes('font-size: 18px'));
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
it('generates font-family sans', () => {
|
|
1759
|
+
const token = { property: 'font', value: 'sans', attrType: 'visual', raw: 'font:sans' };
|
|
1760
|
+
const config = createTestConfig();
|
|
1761
|
+
const css = generateCSS([token], config);
|
|
1762
|
+
assert.ok(css.includes('font-family: ui-sans-serif'));
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
it('generates font-family mono', () => {
|
|
1766
|
+
const token = { property: 'font', value: 'mono', attrType: 'visual', raw: 'font:mono' };
|
|
1767
|
+
const config = createTestConfig();
|
|
1768
|
+
const css = generateCSS([token], config);
|
|
1769
|
+
assert.ok(css.includes('font-family: ui-monospace'));
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
});
|
|
1773
|
+
|
|
1774
|
+
describe('Gradient Utilities', () => {
|
|
1775
|
+
|
|
1776
|
+
it('generates via color', () => {
|
|
1777
|
+
const token = { property: 'via', value: 'secondary', attrType: 'visual', raw: 'via:secondary' };
|
|
1778
|
+
const config = createTestConfig();
|
|
1779
|
+
const css = generateCSS([token], config);
|
|
1780
|
+
assert.ok(css.includes('--ss-gradient-to'));
|
|
1781
|
+
assert.ok(css.includes('var(--c-secondary)'));
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
it('generates to color', () => {
|
|
1785
|
+
const token = { property: 'to', value: 'accent', attrType: 'visual', raw: 'to:accent' };
|
|
1786
|
+
const config = createTestConfig();
|
|
1787
|
+
const css = generateCSS([token], config);
|
|
1788
|
+
assert.ok(css.includes('--ss-gradient-to: var(--c-accent)'));
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
it('generates text-shadow', () => {
|
|
1792
|
+
const token = { property: 'text-shadow', value: 'medium', attrType: 'visual', raw: 'text-shadow:medium' };
|
|
1793
|
+
const config = createTestConfig();
|
|
1794
|
+
const css = generateCSS([token], config);
|
|
1795
|
+
assert.ok(css.includes('text-shadow:'));
|
|
1796
|
+
});
|
|
1797
|
+
|
|
1798
|
+
it('generates gradient from color', () => {
|
|
1799
|
+
const token = { property: 'from', value: 'primary', attrType: 'visual', raw: 'from:primary' };
|
|
1800
|
+
const config = createTestConfig();
|
|
1801
|
+
const css = generateCSS([token], config);
|
|
1802
|
+
assert.ok(css.includes('--ss-gradient-from: var(--c-primary)'));
|
|
1803
|
+
});
|
|
1804
|
+
|
|
1805
|
+
it('generates bg-size', () => {
|
|
1806
|
+
const token = { property: 'bg-size', value: 'cover', attrType: 'visual', raw: 'bg-size:cover' };
|
|
1807
|
+
const config = createTestConfig();
|
|
1808
|
+
const css = generateCSS([token], config);
|
|
1809
|
+
assert.ok(css.includes('background-size: cover'));
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
it('generates bg-blend', () => {
|
|
1813
|
+
const token = { property: 'bg-blend', value: 'multiply', attrType: 'visual', raw: 'bg-blend:multiply' };
|
|
1814
|
+
const config = createTestConfig();
|
|
1815
|
+
const css = generateCSS([token], config);
|
|
1816
|
+
assert.ok(css.includes('background-blend-mode: multiply'));
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
it('generates bg-position', () => {
|
|
1820
|
+
const token = { property: 'bg-position', value: 'top-right', attrType: 'visual', raw: 'bg-position:top-right' };
|
|
1821
|
+
const config = createTestConfig();
|
|
1822
|
+
const css = generateCSS([token], config);
|
|
1823
|
+
assert.ok(css.includes('background-position: top right'));
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
it('generates bg-repeat', () => {
|
|
1827
|
+
const token = { property: 'bg-repeat', value: 'no-repeat', attrType: 'visual', raw: 'bg-repeat:no-repeat' };
|
|
1828
|
+
const config = createTestConfig();
|
|
1829
|
+
const css = generateCSS([token], config);
|
|
1830
|
+
assert.ok(css.includes('background-repeat: no-repeat'));
|
|
1831
|
+
});
|
|
1832
|
+
|
|
1833
|
+
it('generates bg-origin', () => {
|
|
1834
|
+
const token = { property: 'bg-origin', value: 'content', attrType: 'visual', raw: 'bg-origin:content' };
|
|
1835
|
+
const config = createTestConfig();
|
|
1836
|
+
const css = generateCSS([token], config);
|
|
1837
|
+
assert.ok(css.includes('background-origin: content-box'));
|
|
1838
|
+
});
|
|
1839
|
+
|
|
1840
|
+
});
|
|
1841
|
+
|
|
1842
|
+
describe('Interactivity Utilities', () => {
|
|
1843
|
+
|
|
1844
|
+
describe('Cursor', () => {
|
|
1845
|
+
it('generates cursor: pointer', () => {
|
|
1846
|
+
const token = { property: 'cursor', value: 'pointer', attrType: 'visual', raw: 'cursor:pointer' };
|
|
1847
|
+
const config = createTestConfig();
|
|
1848
|
+
const css = generateCSS([token], config);
|
|
1849
|
+
assert.ok(css.includes('cursor: pointer'));
|
|
1850
|
+
});
|
|
1851
|
+
|
|
1852
|
+
it('generates cursor: not-allowed', () => {
|
|
1853
|
+
const token = { property: 'cursor', value: 'not-allowed', attrType: 'visual', raw: 'cursor:not-allowed' };
|
|
1854
|
+
const config = createTestConfig();
|
|
1855
|
+
const css = generateCSS([token], config);
|
|
1856
|
+
assert.ok(css.includes('cursor: not-allowed'));
|
|
1857
|
+
});
|
|
1858
|
+
});
|
|
1859
|
+
|
|
1860
|
+
describe('Accent Color', () => {
|
|
1861
|
+
it('generates accent-color with named color', () => {
|
|
1862
|
+
const token = { property: 'accent', value: 'primary', attrType: 'visual', raw: 'accent:primary' };
|
|
1863
|
+
const config = createTestConfig();
|
|
1864
|
+
const css = generateCSS([token], config);
|
|
1865
|
+
assert.ok(css.includes('accent-color: var(--c-primary)'));
|
|
1866
|
+
});
|
|
1867
|
+
|
|
1868
|
+
it('generates accent-color with arbitrary value', () => {
|
|
1869
|
+
const token = { property: 'accent', value: '#FF0000', isArbitrary: true, attrType: 'visual', raw: 'accent:[#FF0000]' };
|
|
1870
|
+
const config = createTestConfig();
|
|
1871
|
+
const css = generateCSS([token], config);
|
|
1872
|
+
assert.ok(css.includes('accent-color: #FF0000'));
|
|
1873
|
+
});
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
describe('Caret Color', () => {
|
|
1877
|
+
it('generates caret-color with named color', () => {
|
|
1878
|
+
const token = { property: 'caret', value: 'danger', attrType: 'visual', raw: 'caret:danger' };
|
|
1879
|
+
const config = createTestConfig();
|
|
1880
|
+
const css = generateCSS([token], config);
|
|
1881
|
+
assert.ok(css.includes('caret-color: var(--c-danger)'));
|
|
1882
|
+
});
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
describe('Pointer Events', () => {
|
|
1886
|
+
it('generates pointer-events: none', () => {
|
|
1887
|
+
const token = { property: 'pointer-events', value: 'none', attrType: 'visual', raw: 'pointer-events:none' };
|
|
1888
|
+
const config = createTestConfig();
|
|
1889
|
+
const css = generateCSS([token], config);
|
|
1890
|
+
assert.ok(css.includes('pointer-events: none'));
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1893
|
+
it('generates pointer-events: auto', () => {
|
|
1894
|
+
const token = { property: 'pointer-events', value: 'auto', attrType: 'visual', raw: 'pointer-events:auto' };
|
|
1895
|
+
const config = createTestConfig();
|
|
1896
|
+
const css = generateCSS([token], config);
|
|
1897
|
+
assert.ok(css.includes('pointer-events: auto'));
|
|
1898
|
+
});
|
|
1899
|
+
});
|
|
1900
|
+
|
|
1901
|
+
describe('Resize', () => {
|
|
1902
|
+
it('generates resize: none', () => {
|
|
1903
|
+
const token = { property: 'resize', value: 'none', attrType: 'visual', raw: 'resize:none' };
|
|
1904
|
+
const config = createTestConfig();
|
|
1905
|
+
const css = generateCSS([token], config);
|
|
1906
|
+
assert.ok(css.includes('resize: none'));
|
|
1907
|
+
});
|
|
1908
|
+
|
|
1909
|
+
it('generates resize: x (horizontal)', () => {
|
|
1910
|
+
const token = { property: 'resize', value: 'x', attrType: 'visual', raw: 'resize:x' };
|
|
1911
|
+
const config = createTestConfig();
|
|
1912
|
+
const css = generateCSS([token], config);
|
|
1913
|
+
assert.ok(css.includes('resize: horizontal'));
|
|
1914
|
+
});
|
|
1915
|
+
|
|
1916
|
+
it('generates resize: y (vertical)', () => {
|
|
1917
|
+
const token = { property: 'resize', value: 'y', attrType: 'visual', raw: 'resize:y' };
|
|
1918
|
+
const config = createTestConfig();
|
|
1919
|
+
const css = generateCSS([token], config);
|
|
1920
|
+
assert.ok(css.includes('resize: vertical'));
|
|
1921
|
+
});
|
|
1922
|
+
|
|
1923
|
+
it('generates resize: both', () => {
|
|
1924
|
+
const token = { property: 'resize', value: 'both', attrType: 'visual', raw: 'resize:both' };
|
|
1925
|
+
const config = createTestConfig();
|
|
1926
|
+
const css = generateCSS([token], config);
|
|
1927
|
+
assert.ok(css.includes('resize: both'));
|
|
1928
|
+
});
|
|
1929
|
+
});
|
|
1930
|
+
|
|
1931
|
+
describe('Scroll Behavior', () => {
|
|
1932
|
+
it('generates scroll-behavior: smooth', () => {
|
|
1933
|
+
const token = { property: 'scroll', value: 'smooth', attrType: 'visual', raw: 'scroll:smooth' };
|
|
1934
|
+
const config = createTestConfig();
|
|
1935
|
+
const css = generateCSS([token], config);
|
|
1936
|
+
assert.ok(css.includes('scroll-behavior: smooth'));
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
it('generates scroll-behavior: auto', () => {
|
|
1940
|
+
const token = { property: 'scroll', value: 'auto', attrType: 'visual', raw: 'scroll:auto' };
|
|
1941
|
+
const config = createTestConfig();
|
|
1942
|
+
const css = generateCSS([token], config);
|
|
1943
|
+
assert.ok(css.includes('scroll-behavior: auto'));
|
|
1944
|
+
});
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
describe('Scroll Margin', () => {
|
|
1948
|
+
it('generates scroll-margin with scale value', () => {
|
|
1949
|
+
const token = { property: 'scroll-m', value: 'medium', attrType: 'visual', raw: 'scroll-m:medium' };
|
|
1950
|
+
const config = createTestConfig();
|
|
1951
|
+
const css = generateCSS([token], config);
|
|
1952
|
+
assert.ok(css.includes('scroll-margin: var(--s-medium)'));
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
it('generates scroll-margin-x', () => {
|
|
1956
|
+
const token = { property: 'scroll-m-x', value: 'small', attrType: 'visual', raw: 'scroll-m-x:small' };
|
|
1957
|
+
const config = createTestConfig();
|
|
1958
|
+
const css = generateCSS([token], config);
|
|
1959
|
+
assert.ok(css.includes('scroll-margin-left: var(--s-small)'));
|
|
1960
|
+
assert.ok(css.includes('scroll-margin-right: var(--s-small)'));
|
|
1961
|
+
});
|
|
1962
|
+
|
|
1963
|
+
it('generates scroll-margin-y', () => {
|
|
1964
|
+
const token = { property: 'scroll-m-y', value: 'big', attrType: 'visual', raw: 'scroll-m-y:big' };
|
|
1965
|
+
const config = createTestConfig();
|
|
1966
|
+
const css = generateCSS([token], config);
|
|
1967
|
+
assert.ok(css.includes('scroll-margin-top: var(--s-big)'));
|
|
1968
|
+
assert.ok(css.includes('scroll-margin-bottom: var(--s-big)'));
|
|
1969
|
+
});
|
|
1970
|
+
});
|
|
1971
|
+
|
|
1972
|
+
describe('Scroll Padding', () => {
|
|
1973
|
+
it('generates scroll-padding', () => {
|
|
1974
|
+
const token = { property: 'scroll-p', value: 'medium', attrType: 'visual', raw: 'scroll-p:medium' };
|
|
1975
|
+
const config = createTestConfig();
|
|
1976
|
+
const css = generateCSS([token], config);
|
|
1977
|
+
assert.ok(css.includes('scroll-padding: var(--s-medium)'));
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
it('generates scroll-padding-x', () => {
|
|
1981
|
+
const token = { property: 'scroll-p-x', value: 'tiny', attrType: 'visual', raw: 'scroll-p-x:tiny' };
|
|
1982
|
+
const config = createTestConfig();
|
|
1983
|
+
const css = generateCSS([token], config);
|
|
1984
|
+
assert.ok(css.includes('scroll-padding-left: var(--s-tiny)'));
|
|
1985
|
+
assert.ok(css.includes('scroll-padding-right: var(--s-tiny)'));
|
|
1986
|
+
});
|
|
1987
|
+
|
|
1988
|
+
it('generates scroll-padding-y', () => {
|
|
1989
|
+
const token = { property: 'scroll-p-y', value: 'giant', attrType: 'visual', raw: 'scroll-p-y:giant' };
|
|
1990
|
+
const config = createTestConfig();
|
|
1991
|
+
const css = generateCSS([token], config);
|
|
1992
|
+
assert.ok(css.includes('scroll-padding-top: var(--s-giant)'));
|
|
1993
|
+
assert.ok(css.includes('scroll-padding-bottom: var(--s-giant)'));
|
|
1994
|
+
});
|
|
1995
|
+
});
|
|
1996
|
+
|
|
1997
|
+
describe('Scroll Snap', () => {
|
|
1998
|
+
it('generates scroll-snap-type: none', () => {
|
|
1999
|
+
const token = { property: 'snap', value: 'none', attrType: 'visual', raw: 'snap:none' };
|
|
2000
|
+
const config = createTestConfig();
|
|
2001
|
+
const css = generateCSS([token], config);
|
|
2002
|
+
assert.ok(css.includes('scroll-snap-type: none'));
|
|
2003
|
+
});
|
|
2004
|
+
|
|
2005
|
+
it('generates scroll-snap-type: x mandatory', () => {
|
|
2006
|
+
const token = { property: 'snap', value: 'x', attrType: 'visual', raw: 'snap:x' };
|
|
2007
|
+
const config = createTestConfig();
|
|
2008
|
+
const css = generateCSS([token], config);
|
|
2009
|
+
assert.ok(css.includes('scroll-snap-type: x mandatory'));
|
|
2010
|
+
});
|
|
2011
|
+
|
|
2012
|
+
it('generates scroll-snap-type: y mandatory', () => {
|
|
2013
|
+
const token = { property: 'snap', value: 'y', attrType: 'visual', raw: 'snap:y' };
|
|
2014
|
+
const config = createTestConfig();
|
|
2015
|
+
const css = generateCSS([token], config);
|
|
2016
|
+
assert.ok(css.includes('scroll-snap-type: y mandatory'));
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
it('generates scroll-snap-type: both mandatory', () => {
|
|
2020
|
+
const token = { property: 'snap', value: 'both', attrType: 'visual', raw: 'snap:both' };
|
|
2021
|
+
const config = createTestConfig();
|
|
2022
|
+
const css = generateCSS([token], config);
|
|
2023
|
+
assert.ok(css.includes('scroll-snap-type: both mandatory'));
|
|
2024
|
+
});
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
describe('Scroll Snap Align', () => {
|
|
2028
|
+
it('generates scroll-snap-align: start', () => {
|
|
2029
|
+
const token = { property: 'snap-align', value: 'start', attrType: 'visual', raw: 'snap-align:start' };
|
|
2030
|
+
const config = createTestConfig();
|
|
2031
|
+
const css = generateCSS([token], config);
|
|
2032
|
+
assert.ok(css.includes('scroll-snap-align: start'));
|
|
2033
|
+
});
|
|
2034
|
+
|
|
2035
|
+
it('generates scroll-snap-align: center', () => {
|
|
2036
|
+
const token = { property: 'snap-align', value: 'center', attrType: 'visual', raw: 'snap-align:center' };
|
|
2037
|
+
const config = createTestConfig();
|
|
2038
|
+
const css = generateCSS([token], config);
|
|
2039
|
+
assert.ok(css.includes('scroll-snap-align: center'));
|
|
2040
|
+
});
|
|
2041
|
+
});
|
|
2042
|
+
|
|
2043
|
+
describe('Scroll Snap Stop', () => {
|
|
2044
|
+
it('generates scroll-snap-stop: normal', () => {
|
|
2045
|
+
const token = { property: 'snap-stop', value: 'normal', attrType: 'visual', raw: 'snap-stop:normal' };
|
|
2046
|
+
const config = createTestConfig();
|
|
2047
|
+
const css = generateCSS([token], config);
|
|
2048
|
+
assert.ok(css.includes('scroll-snap-stop: normal'));
|
|
2049
|
+
});
|
|
2050
|
+
|
|
2051
|
+
it('generates scroll-snap-stop: always', () => {
|
|
2052
|
+
const token = { property: 'snap-stop', value: 'always', attrType: 'visual', raw: 'snap-stop:always' };
|
|
2053
|
+
const config = createTestConfig();
|
|
2054
|
+
const css = generateCSS([token], config);
|
|
2055
|
+
assert.ok(css.includes('scroll-snap-stop: always'));
|
|
2056
|
+
});
|
|
2057
|
+
});
|
|
2058
|
+
|
|
2059
|
+
describe('Touch Action', () => {
|
|
2060
|
+
it('generates touch-action: none', () => {
|
|
2061
|
+
const token = { property: 'touch', value: 'none', attrType: 'visual', raw: 'touch:none' };
|
|
2062
|
+
const config = createTestConfig();
|
|
2063
|
+
const css = generateCSS([token], config);
|
|
2064
|
+
assert.ok(css.includes('touch-action: none'));
|
|
2065
|
+
});
|
|
2066
|
+
|
|
2067
|
+
it('generates touch-action: manipulation', () => {
|
|
2068
|
+
const token = { property: 'touch', value: 'manipulation', attrType: 'visual', raw: 'touch:manipulation' };
|
|
2069
|
+
const config = createTestConfig();
|
|
2070
|
+
const css = generateCSS([token], config);
|
|
2071
|
+
assert.ok(css.includes('touch-action: manipulation'));
|
|
2072
|
+
});
|
|
2073
|
+
|
|
2074
|
+
it('generates touch-action: pan-x', () => {
|
|
2075
|
+
const token = { property: 'touch', value: 'pan-x', attrType: 'visual', raw: 'touch:pan-x' };
|
|
2076
|
+
const config = createTestConfig();
|
|
2077
|
+
const css = generateCSS([token], config);
|
|
2078
|
+
assert.ok(css.includes('touch-action: pan-x'));
|
|
2079
|
+
});
|
|
2080
|
+
|
|
2081
|
+
it('generates touch-action: pan-y', () => {
|
|
2082
|
+
const token = { property: 'touch', value: 'pan-y', attrType: 'visual', raw: 'touch:pan-y' };
|
|
2083
|
+
const config = createTestConfig();
|
|
2084
|
+
const css = generateCSS([token], config);
|
|
2085
|
+
assert.ok(css.includes('touch-action: pan-y'));
|
|
2086
|
+
});
|
|
2087
|
+
});
|
|
2088
|
+
|
|
2089
|
+
describe('User Select', () => {
|
|
2090
|
+
it('generates user-select: none', () => {
|
|
2091
|
+
const token = { property: 'select', value: 'none', attrType: 'visual', raw: 'select:none' };
|
|
2092
|
+
const config = createTestConfig();
|
|
2093
|
+
const css = generateCSS([token], config);
|
|
2094
|
+
assert.ok(css.includes('user-select: none'));
|
|
2095
|
+
});
|
|
2096
|
+
|
|
2097
|
+
it('generates user-select: text', () => {
|
|
2098
|
+
const token = { property: 'select', value: 'text', attrType: 'visual', raw: 'select:text' };
|
|
2099
|
+
const config = createTestConfig();
|
|
2100
|
+
const css = generateCSS([token], config);
|
|
2101
|
+
assert.ok(css.includes('user-select: text'));
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
it('generates user-select: all', () => {
|
|
2105
|
+
const token = { property: 'select', value: 'all', attrType: 'visual', raw: 'select:all' };
|
|
2106
|
+
const config = createTestConfig();
|
|
2107
|
+
const css = generateCSS([token], config);
|
|
2108
|
+
assert.ok(css.includes('user-select: all'));
|
|
2109
|
+
});
|
|
2110
|
+
});
|
|
2111
|
+
|
|
2112
|
+
describe('Will Change', () => {
|
|
2113
|
+
it('generates will-change: auto', () => {
|
|
2114
|
+
const token = { property: 'will-change', value: 'auto', attrType: 'visual', raw: 'will-change:auto' };
|
|
2115
|
+
const config = createTestConfig();
|
|
2116
|
+
const css = generateCSS([token], config);
|
|
2117
|
+
assert.ok(css.includes('will-change: auto'));
|
|
2118
|
+
});
|
|
2119
|
+
|
|
2120
|
+
it('generates will-change: scroll (scroll-position)', () => {
|
|
2121
|
+
const token = { property: 'will-change', value: 'scroll', attrType: 'visual', raw: 'will-change:scroll' };
|
|
2122
|
+
const config = createTestConfig();
|
|
2123
|
+
const css = generateCSS([token], config);
|
|
2124
|
+
assert.ok(css.includes('will-change: scroll-position'));
|
|
2125
|
+
});
|
|
2126
|
+
|
|
2127
|
+
it('generates will-change: transform', () => {
|
|
2128
|
+
const token = { property: 'will-change', value: 'transform', attrType: 'visual', raw: 'will-change:transform' };
|
|
2129
|
+
const config = createTestConfig();
|
|
2130
|
+
const css = generateCSS([token], config);
|
|
2131
|
+
assert.ok(css.includes('will-change: transform'));
|
|
2132
|
+
});
|
|
2133
|
+
|
|
2134
|
+
it('generates will-change: opacity', () => {
|
|
2135
|
+
const token = { property: 'will-change', value: 'opacity', attrType: 'visual', raw: 'will-change:opacity' };
|
|
2136
|
+
const config = createTestConfig();
|
|
2137
|
+
const css = generateCSS([token], config);
|
|
2138
|
+
assert.ok(css.includes('will-change: opacity'));
|
|
2139
|
+
});
|
|
2140
|
+
});
|
|
2141
|
+
|
|
2142
|
+
describe('Appearance', () => {
|
|
2143
|
+
it('generates appearance: none', () => {
|
|
2144
|
+
const token = { property: 'appearance', value: 'none', attrType: 'visual', raw: 'appearance:none' };
|
|
2145
|
+
const config = createTestConfig();
|
|
2146
|
+
const css = generateCSS([token], config);
|
|
2147
|
+
assert.ok(css.includes('appearance: none'));
|
|
2148
|
+
});
|
|
2149
|
+
|
|
2150
|
+
it('generates appearance: auto', () => {
|
|
2151
|
+
const token = { property: 'appearance', value: 'auto', attrType: 'visual', raw: 'appearance:auto' };
|
|
2152
|
+
const config = createTestConfig();
|
|
2153
|
+
const css = generateCSS([token], config);
|
|
2154
|
+
assert.ok(css.includes('appearance: auto'));
|
|
2155
|
+
});
|
|
2156
|
+
});
|
|
2157
|
+
|
|
2158
|
+
describe('Field Sizing', () => {
|
|
2159
|
+
it('generates field-sizing: content', () => {
|
|
2160
|
+
const token = { property: 'field-sizing', value: 'content', attrType: 'visual', raw: 'field-sizing:content' };
|
|
2161
|
+
const config = createTestConfig();
|
|
2162
|
+
const css = generateCSS([token], config);
|
|
2163
|
+
assert.ok(css.includes('field-sizing: content'));
|
|
2164
|
+
});
|
|
2165
|
+
});
|
|
2166
|
+
|
|
2167
|
+
describe('Color Scheme', () => {
|
|
2168
|
+
it('generates color-scheme: light', () => {
|
|
2169
|
+
const token = { property: 'color-scheme', value: 'light', attrType: 'visual', raw: 'color-scheme:light' };
|
|
2170
|
+
const config = createTestConfig();
|
|
2171
|
+
const css = generateCSS([token], config);
|
|
2172
|
+
assert.ok(css.includes('color-scheme: light'));
|
|
2173
|
+
});
|
|
2174
|
+
|
|
2175
|
+
it('generates color-scheme: dark', () => {
|
|
2176
|
+
const token = { property: 'color-scheme', value: 'dark', attrType: 'visual', raw: 'color-scheme:dark' };
|
|
2177
|
+
const config = createTestConfig();
|
|
2178
|
+
const css = generateCSS([token], config);
|
|
2179
|
+
assert.ok(css.includes('color-scheme: dark'));
|
|
2180
|
+
});
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
describe('SVG Utilities', () => {
|
|
2186
|
+
|
|
2187
|
+
describe('Fill', () => {
|
|
2188
|
+
it('generates fill: none', () => {
|
|
2189
|
+
const token = { property: 'fill', value: 'none', attrType: 'visual', raw: 'fill:none' };
|
|
2190
|
+
const config = createTestConfig();
|
|
2191
|
+
const css = generateCSS([token], config);
|
|
2192
|
+
assert.ok(css.includes('fill: none'));
|
|
2193
|
+
});
|
|
2194
|
+
|
|
2195
|
+
it('generates fill: currentColor', () => {
|
|
2196
|
+
const token = { property: 'fill', value: 'current', attrType: 'visual', raw: 'fill:current' };
|
|
2197
|
+
const config = createTestConfig();
|
|
2198
|
+
const css = generateCSS([token], config);
|
|
2199
|
+
assert.ok(css.includes('fill: currentColor'));
|
|
2200
|
+
});
|
|
2201
|
+
|
|
2202
|
+
it('generates fill with named color', () => {
|
|
2203
|
+
const token = { property: 'fill', value: 'primary', attrType: 'visual', raw: 'fill:primary' };
|
|
2204
|
+
const config = createTestConfig();
|
|
2205
|
+
const css = generateCSS([token], config);
|
|
2206
|
+
assert.ok(css.includes('fill: var(--c-primary)'));
|
|
2207
|
+
});
|
|
2208
|
+
|
|
2209
|
+
it('generates fill with arbitrary value', () => {
|
|
2210
|
+
const token = { property: 'fill', value: '#00FF00', isArbitrary: true, attrType: 'visual', raw: 'fill:[#00FF00]' };
|
|
2211
|
+
const config = createTestConfig();
|
|
2212
|
+
const css = generateCSS([token], config);
|
|
2213
|
+
assert.ok(css.includes('fill: #00FF00'));
|
|
2214
|
+
});
|
|
2215
|
+
});
|
|
2216
|
+
|
|
2217
|
+
describe('Stroke', () => {
|
|
2218
|
+
it('generates stroke: none', () => {
|
|
2219
|
+
const token = { property: 'stroke', value: 'none', attrType: 'visual', raw: 'stroke:none' };
|
|
2220
|
+
const config = createTestConfig();
|
|
2221
|
+
const css = generateCSS([token], config);
|
|
2222
|
+
assert.ok(css.includes('stroke: none'));
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
it('generates stroke: currentColor', () => {
|
|
2226
|
+
const token = { property: 'stroke', value: 'current', attrType: 'visual', raw: 'stroke:current' };
|
|
2227
|
+
const config = createTestConfig();
|
|
2228
|
+
const css = generateCSS([token], config);
|
|
2229
|
+
assert.ok(css.includes('stroke: currentColor'));
|
|
2230
|
+
});
|
|
2231
|
+
|
|
2232
|
+
it('generates stroke with named color', () => {
|
|
2233
|
+
const token = { property: 'stroke', value: 'danger', attrType: 'visual', raw: 'stroke:danger' };
|
|
2234
|
+
const config = createTestConfig();
|
|
2235
|
+
const css = generateCSS([token], config);
|
|
2236
|
+
assert.ok(css.includes('stroke: var(--c-danger)'));
|
|
2237
|
+
});
|
|
2238
|
+
|
|
2239
|
+
it('generates stroke with arbitrary value', () => {
|
|
2240
|
+
const token = { property: 'stroke', value: 'rgba(0,0,0,0.5)', isArbitrary: true, attrType: 'visual', raw: 'stroke:[rgba(0,0,0,0.5)]' };
|
|
2241
|
+
const config = createTestConfig();
|
|
2242
|
+
const css = generateCSS([token], config);
|
|
2243
|
+
assert.ok(css.includes('stroke: rgba(0,0,0,0.5)'));
|
|
2244
|
+
});
|
|
2245
|
+
});
|
|
2246
|
+
|
|
2247
|
+
describe('Stroke Width', () => {
|
|
2248
|
+
it('generates stroke-width with number', () => {
|
|
2249
|
+
const token = { property: 'stroke-w', value: '2', attrType: 'visual', raw: 'stroke-w:2' };
|
|
2250
|
+
const config = createTestConfig();
|
|
2251
|
+
const css = generateCSS([token], config);
|
|
2252
|
+
assert.ok(css.includes('stroke-width: 2px'));
|
|
2253
|
+
});
|
|
2254
|
+
|
|
2255
|
+
it('generates stroke-width with arbitrary value', () => {
|
|
2256
|
+
const token = { property: 'stroke-w', value: '0.5rem', isArbitrary: true, attrType: 'visual', raw: 'stroke-w:[0.5rem]' };
|
|
2257
|
+
const config = createTestConfig();
|
|
2258
|
+
const css = generateCSS([token], config);
|
|
2259
|
+
assert.ok(css.includes('stroke-width: 0.5rem'));
|
|
2260
|
+
});
|
|
2261
|
+
});
|
|
2262
|
+
|
|
2263
|
+
});
|
|
2264
|
+
|
|
2265
|
+
describe('Accessibility Utilities', () => {
|
|
2266
|
+
|
|
2267
|
+
describe('Forced Colors', () => {
|
|
2268
|
+
it('generates forced-color-adjust: auto', () => {
|
|
2269
|
+
const token = { property: 'forced-colors', value: 'auto', attrType: 'visual', raw: 'forced-colors:auto' };
|
|
2270
|
+
const config = createTestConfig();
|
|
2271
|
+
const css = generateCSS([token], config);
|
|
2272
|
+
assert.ok(css.includes('forced-color-adjust: auto'));
|
|
2273
|
+
});
|
|
2274
|
+
|
|
2275
|
+
it('generates forced-color-adjust: none', () => {
|
|
2276
|
+
const token = { property: 'forced-colors', value: 'none', attrType: 'visual', raw: 'forced-colors:none' };
|
|
2277
|
+
const config = createTestConfig();
|
|
2278
|
+
const css = generateCSS([token], config);
|
|
2279
|
+
assert.ok(css.includes('forced-color-adjust: none'));
|
|
2280
|
+
});
|
|
2281
|
+
});
|
|
2282
|
+
|
|
2283
|
+
});
|
|
2284
|
+
|
|
2285
|
+
describe('Scroll Margin/Padding Individual Sides', () => {
|
|
2286
|
+
|
|
2287
|
+
describe('Scroll Margin Sides', () => {
|
|
2288
|
+
it('generates scroll-margin-top', () => {
|
|
2289
|
+
const token = { property: 'scroll-m-t', value: 'small', attrType: 'visual', raw: 'scroll-m-t:small' };
|
|
2290
|
+
const config = createTestConfig();
|
|
2291
|
+
const css = generateCSS([token], config);
|
|
2292
|
+
assert.ok(css.includes('scroll-margin-top: var(--s-small)'));
|
|
2293
|
+
});
|
|
2294
|
+
|
|
2295
|
+
it('generates scroll-margin-right', () => {
|
|
2296
|
+
const token = { property: 'scroll-m-r', value: 'medium', attrType: 'visual', raw: 'scroll-m-r:medium' };
|
|
2297
|
+
const config = createTestConfig();
|
|
2298
|
+
const css = generateCSS([token], config);
|
|
2299
|
+
assert.ok(css.includes('scroll-margin-right: var(--s-medium)'));
|
|
2300
|
+
});
|
|
2301
|
+
|
|
2302
|
+
it('generates scroll-margin-bottom', () => {
|
|
2303
|
+
const token = { property: 'scroll-m-b', value: 'big', attrType: 'visual', raw: 'scroll-m-b:big' };
|
|
2304
|
+
const config = createTestConfig();
|
|
2305
|
+
const css = generateCSS([token], config);
|
|
2306
|
+
assert.ok(css.includes('scroll-margin-bottom: var(--s-big)'));
|
|
2307
|
+
});
|
|
2308
|
+
|
|
2309
|
+
it('generates scroll-margin-left', () => {
|
|
2310
|
+
const token = { property: 'scroll-m-l', value: 'tiny', attrType: 'visual', raw: 'scroll-m-l:tiny' };
|
|
2311
|
+
const config = createTestConfig();
|
|
2312
|
+
const css = generateCSS([token], config);
|
|
2313
|
+
assert.ok(css.includes('scroll-margin-left: var(--s-tiny)'));
|
|
2314
|
+
});
|
|
2315
|
+
});
|
|
2316
|
+
|
|
2317
|
+
describe('Scroll Padding Sides', () => {
|
|
2318
|
+
it('generates scroll-padding-top', () => {
|
|
2319
|
+
const token = { property: 'scroll-p-t', value: 'small', attrType: 'visual', raw: 'scroll-p-t:small' };
|
|
2320
|
+
const config = createTestConfig();
|
|
2321
|
+
const css = generateCSS([token], config);
|
|
2322
|
+
assert.ok(css.includes('scroll-padding-top: var(--s-small)'));
|
|
2323
|
+
});
|
|
2324
|
+
|
|
2325
|
+
it('generates scroll-padding-right', () => {
|
|
2326
|
+
const token = { property: 'scroll-p-r', value: 'medium', attrType: 'visual', raw: 'scroll-p-r:medium' };
|
|
2327
|
+
const config = createTestConfig();
|
|
2328
|
+
const css = generateCSS([token], config);
|
|
2329
|
+
assert.ok(css.includes('scroll-padding-right: var(--s-medium)'));
|
|
2330
|
+
});
|
|
2331
|
+
|
|
2332
|
+
it('generates scroll-padding-bottom', () => {
|
|
2333
|
+
const token = { property: 'scroll-p-b', value: 'big', attrType: 'visual', raw: 'scroll-p-b:big' };
|
|
2334
|
+
const config = createTestConfig();
|
|
2335
|
+
const css = generateCSS([token], config);
|
|
2336
|
+
assert.ok(css.includes('scroll-padding-bottom: var(--s-big)'));
|
|
2337
|
+
});
|
|
2338
|
+
|
|
2339
|
+
it('generates scroll-padding-left', () => {
|
|
2340
|
+
const token = { property: 'scroll-p-l', value: 'tiny', attrType: 'visual', raw: 'scroll-p-l:tiny' };
|
|
2341
|
+
const config = createTestConfig();
|
|
2342
|
+
const css = generateCSS([token], config);
|
|
2343
|
+
assert.ok(css.includes('scroll-padding-left: var(--s-tiny)'));
|
|
2344
|
+
});
|
|
2345
|
+
});
|
|
2346
|
+
|
|
2347
|
+
});
|
|
2348
|
+
|
|
2349
|
+
describe('Divide with State', () => {
|
|
2350
|
+
|
|
2351
|
+
it('generates divide utility with hover state', () => {
|
|
2352
|
+
const token = {
|
|
2353
|
+
property: 'divide',
|
|
2354
|
+
value: 'primary',
|
|
2355
|
+
attrType: 'visual',
|
|
2356
|
+
raw: 'divide:primary',
|
|
2357
|
+
state: 'hover'
|
|
2358
|
+
};
|
|
2359
|
+
const config = createTestConfig();
|
|
2360
|
+
const css = generateCSS([token], config);
|
|
2361
|
+
// Divide utilities with state add the pseudo-class to the child selector
|
|
2362
|
+
assert.ok(css.includes('> :not([hidden]) ~ :not([hidden]):hover'), 'Should include divide child selector with hover');
|
|
2363
|
+
assert.ok(css.includes('border-color: var(--c-primary)'));
|
|
2364
|
+
});
|
|
2365
|
+
|
|
2366
|
+
});
|
|
2367
|
+
|
|
2368
|
+
describe('Dark Mode Array Config', () => {
|
|
2369
|
+
|
|
2370
|
+
it('generates dark mode with custom array selector', () => {
|
|
2371
|
+
const token = {
|
|
2372
|
+
state: 'dark',
|
|
2373
|
+
property: 'bg',
|
|
2374
|
+
value: 'black',
|
|
2375
|
+
attrType: 'visual',
|
|
2376
|
+
raw: 'dark:bg:black'
|
|
2377
|
+
};
|
|
2378
|
+
const config = createTestConfig({ darkMode: ['selector', '[data-theme="dark"]'] });
|
|
2379
|
+
const css = generateCSS([token], config);
|
|
2380
|
+
assert.ok(css.includes('[data-theme="dark"]'));
|
|
2381
|
+
assert.ok(css.includes('background-color: var(--c-black)'));
|
|
2382
|
+
});
|
|
2383
|
+
|
|
2384
|
+
it('generates dark mode with array but no second element (defaults to .dark)', () => {
|
|
2385
|
+
const token = {
|
|
2386
|
+
state: 'dark',
|
|
2387
|
+
property: 'text',
|
|
2388
|
+
value: 'white',
|
|
2389
|
+
attrType: 'visual',
|
|
2390
|
+
raw: 'dark:text:white'
|
|
2391
|
+
};
|
|
2392
|
+
const config = createTestConfig({ darkMode: ['selector'] });
|
|
2393
|
+
const css = generateCSS([token], config);
|
|
2394
|
+
assert.ok(css.includes('.dark'));
|
|
2395
|
+
assert.ok(css.includes('color: var(--c-white)'));
|
|
2396
|
+
});
|
|
2397
|
+
|
|
2398
|
+
});
|
|
2399
|
+
|
|
983
2400
|
});
|