xmlui 0.11.2 → 0.11.4
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/lib/{index-DyhCY6Ga.js → index-Cq0EMm3L.js} +390 -347
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-DN7MXrdn.js → initMock-DCigV4Zh.js} +1 -1
- package/dist/lib/language-server-web-worker.js +1 -1
- package/dist/lib/language-server.js +1 -1
- package/dist/lib/{metadata-utils-D27cn-XB.js → metadata-utils-BiolWMg9.js} +5 -6
- package/dist/lib/{server-common-2DaoOOL5.js → server-common-DyCHOk-z.js} +206 -90
- package/dist/lib/testing.js +1 -1
- package/dist/lib/{transform-Tooy42EB.js → transform-DHf9tQF7.js} +15 -1
- package/dist/lib/vite-xmlui-plugin/index.js +19 -2
- package/dist/lib/{xmlui-parser-BZZ430Wm.js → xmlui-parser-CHN3mADy.js} +1 -1
- package/dist/lib/xmlui-parser.d.ts +2 -0
- package/dist/lib/xmlui-parser.js +2 -2
- package/dist/lib/{xmlui-serializer-D9D2mQ8m.js → xmlui-serializer-CYNSHAlP.js} +1 -1
- package/dist/lib/xmlui.d.ts +2 -1
- package/dist/lib/xmlui.js +3 -3
- package/dist/metadata/{collectedComponentMetadata-BNSnCrzh.js → collectedComponentMetadata-CLaDZhmc.js} +401 -343
- package/dist/metadata/{initMock-CVnDRyRf.js → initMock-Buqah4JF.js} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.js +1 -1
- package/dist/metadata/xmlui-metadata.umd.cjs +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +113 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +10 -4
- package/dist/scripts/src/components/Charts/LabelList/LabelList.js +2 -2
- package/dist/scripts/src/components/Charts/LabelList/LabelListNative.js +2 -2
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +1 -1
- package/dist/scripts/src/components/Checkbox/Checkbox.js +6 -6
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +30 -99
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +57 -14
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +88 -17
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +9 -9
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +111 -86
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +6 -6
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +30 -28
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +1 -1
- package/dist/scripts/src/components/Select/Select.js +1 -1
- package/dist/scripts/src/components/Select/Select.spec.js +92 -0
- package/dist/scripts/src/components/Slider/Slider.js +5 -5
- package/dist/scripts/src/components/Slider/Slider.spec.js +63 -29
- package/dist/scripts/src/components/Splitter/Splitter.js +53 -3
- package/dist/scripts/src/components/Splitter/Splitter.spec.js +313 -0
- package/dist/scripts/src/components/Splitter/SplitterNative.js +48 -22
- package/dist/scripts/src/components/Splitter/utils.js +7 -2
- package/dist/scripts/src/components/Switch/Switch.js +6 -6
- package/dist/scripts/src/components/Switch/Switch.spec.js +44 -46
- package/dist/scripts/src/components/Text/Text.js +17 -16
- package/dist/scripts/src/components/Text/Text.spec.js +284 -0
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +94 -2
- package/dist/scripts/src/components/TextBox/TextBox.js +5 -3
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +92 -59
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +101 -25
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +5 -4
- package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +23 -31
- package/dist/scripts/src/language-server/services/format.js +223 -84
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +3 -2
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +16 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +4 -2
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
|
@@ -63,43 +63,69 @@ exports.defaultProps = {
|
|
|
63
63
|
floating: false,
|
|
64
64
|
};
|
|
65
65
|
const Splitter = (_a) => {
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
const [
|
|
66
|
+
var { initialPrimarySize = exports.defaultProps.initialPrimarySize, minPrimarySize = exports.defaultProps.minPrimarySize, maxPrimarySize = exports.defaultProps.maxPrimarySize, orientation = exports.defaultProps.orientation, children, style, className, swapped = exports.defaultProps.swapped, floating = exports.defaultProps.floating, splitterTemplate, resize = constants_1.noop, visibleChildCount } = _a, rest = __rest(_a, ["initialPrimarySize", "minPrimarySize", "maxPrimarySize", "orientation", "children", "style", "className", "swapped", "floating", "splitterTemplate", "resize", "visibleChildCount"]);
|
|
67
|
+
const [sizePercentage, setSizePercentage] = (0, react_1.useState)(50);
|
|
68
|
+
const [containerSize, setContainerSize] = (0, react_1.useState)(100);
|
|
69
69
|
const [splitter, setSplitter] = (0, react_1.useState)(null);
|
|
70
70
|
const [resizerVisible, setResizerVisible] = (0, react_1.useState)(false);
|
|
71
71
|
const [resizer, setResizer] = (0, react_1.useState)(null);
|
|
72
72
|
const [floatingResizer, setFloatingResizer] = (0, react_1.useState)(null);
|
|
73
73
|
const resizerElement = (0, react_1.useMemo)(() => (floating ? floatingResizer : resizer), [floating, resizer, floatingResizer]);
|
|
74
|
+
// Calculate actual size in pixels from percentage
|
|
75
|
+
const size = (0, react_1.useMemo)(() => {
|
|
76
|
+
return (sizePercentage / 100) * containerSize;
|
|
77
|
+
}, [sizePercentage, containerSize]);
|
|
78
|
+
// Since the XMLUI renderer now pre-filters children, we can use them directly
|
|
79
|
+
const childrenArray = react_1.default.Children.toArray(children);
|
|
80
|
+
const actualChildCount = childrenArray.length;
|
|
81
|
+
const effectiveChildCount = visibleChildCount !== null && visibleChildCount !== void 0 ? visibleChildCount : actualChildCount;
|
|
82
|
+
const isMultiPanel = effectiveChildCount > 1;
|
|
83
|
+
// ResizeObserver to track container size changes
|
|
84
|
+
(0, react_1.useEffect)(() => {
|
|
85
|
+
if (!splitter)
|
|
86
|
+
return;
|
|
87
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
88
|
+
for (const entry of entries) {
|
|
89
|
+
const newContainerSize = orientation === "horizontal"
|
|
90
|
+
? entry.contentRect.width
|
|
91
|
+
: entry.contentRect.height;
|
|
92
|
+
setContainerSize(newContainerSize);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
resizeObserver.observe(splitter);
|
|
96
|
+
return () => {
|
|
97
|
+
resizeObserver.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, [splitter, orientation]);
|
|
100
|
+
// Initialize container size and primary panel percentage
|
|
74
101
|
(0, react_1.useEffect)(() => {
|
|
75
102
|
if (splitter) {
|
|
76
|
-
const
|
|
103
|
+
const newContainerSize = orientation === "horizontal"
|
|
77
104
|
? splitter.getBoundingClientRect().width
|
|
78
105
|
: splitter.getBoundingClientRect().height;
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
setContainerSize(newContainerSize);
|
|
107
|
+
// Parse initial size and convert to percentage
|
|
108
|
+
const initialParsedSize = (0, utils_1.parseSize)(initialPrimarySize, newContainerSize);
|
|
109
|
+
const initialPercentage = (0, utils_1.toPercentage)(initialParsedSize, newContainerSize);
|
|
110
|
+
setSizePercentage(initialPercentage);
|
|
81
111
|
if (resize) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(0, utils_1.toPercentage)(containerSize - initialParsedSize, containerSize),
|
|
85
|
-
]);
|
|
112
|
+
const actualPrimarySize = (initialPercentage / 100) * newContainerSize;
|
|
113
|
+
resize([actualPrimarySize, newContainerSize - actualPrimarySize]);
|
|
86
114
|
}
|
|
87
115
|
}
|
|
88
116
|
}, [initialPrimarySize, orientation, resize, splitter, swapped]);
|
|
89
117
|
(0, react_1.useEffect)(() => {
|
|
90
118
|
const handleMouseMove = (event) => {
|
|
91
|
-
if (splitter && resizerElement) {
|
|
92
|
-
const containerSize = orientation === "horizontal"
|
|
93
|
-
? splitter.getBoundingClientRect().width
|
|
94
|
-
: splitter.getBoundingClientRect().height;
|
|
119
|
+
if (splitter && resizerElement && containerSize > 0) {
|
|
95
120
|
const newSize = orientation === "horizontal"
|
|
96
121
|
? Math.min(Math.max(event.clientX - splitter.getBoundingClientRect().left, (0, utils_1.parseSize)(minPrimarySize, containerSize)), (0, utils_1.parseSize)(maxPrimarySize, containerSize))
|
|
97
122
|
: Math.min(Math.max(event.clientY - splitter.getBoundingClientRect().top, (0, utils_1.parseSize)(minPrimarySize, containerSize)), (0, utils_1.parseSize)(maxPrimarySize, containerSize));
|
|
98
|
-
|
|
123
|
+
const newPercentage = (0, utils_1.toPercentage)(newSize, containerSize);
|
|
124
|
+
setSizePercentage(newPercentage);
|
|
99
125
|
if (resize) {
|
|
100
126
|
resize([
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
newPercentage,
|
|
128
|
+
100 - newPercentage,
|
|
103
129
|
]);
|
|
104
130
|
}
|
|
105
131
|
}
|
|
@@ -122,7 +148,7 @@ const Splitter = (_a) => {
|
|
|
122
148
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
123
149
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
124
150
|
};
|
|
125
|
-
}, [minPrimarySize, maxPrimarySize, orientation, resize, floating, resizerElement, splitter]);
|
|
151
|
+
}, [minPrimarySize, maxPrimarySize, orientation, resize, floating, resizerElement, splitter, containerSize]);
|
|
126
152
|
(0, react_1.useEffect)(() => {
|
|
127
153
|
const watchResizer = (event) => {
|
|
128
154
|
const cursorPosition = orientation === "horizontal" ? event.clientX : event.clientY;
|
|
@@ -159,21 +185,21 @@ const Splitter = (_a) => {
|
|
|
159
185
|
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { ref: (s) => setSplitter(s), className: (0, classnames_1.default)(Splitter_module_scss_1.default.splitter, {
|
|
160
186
|
[Splitter_module_scss_1.default.horizontal]: orientation === "horizontal",
|
|
161
187
|
[Splitter_module_scss_1.default.vertical]: orientation === "vertical",
|
|
162
|
-
}, className), style: style, children:
|
|
188
|
+
}, className), style: style, children: isMultiPanel ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: !swapped ? { flexBasis: size } : {}, className: (0, classnames_1.default)({
|
|
163
189
|
[Splitter_module_scss_1.default.primaryPanel]: !swapped,
|
|
164
190
|
[Splitter_module_scss_1.default.secondaryPanel]: swapped,
|
|
165
|
-
}), children:
|
|
191
|
+
}), children: childrenArray[0] }), !floating && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Splitter_module_scss_1.default.resizer, {
|
|
166
192
|
[Splitter_module_scss_1.default.horizontal]: orientation === "horizontal",
|
|
167
193
|
[Splitter_module_scss_1.default.vertical]: orientation === "vertical",
|
|
168
194
|
}), ref: (r) => setResizer(r), children: splitterTemplate })), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)({
|
|
169
195
|
[Splitter_module_scss_1.default.primaryPanel]: swapped,
|
|
170
196
|
[Splitter_module_scss_1.default.secondaryPanel]: !swapped,
|
|
171
|
-
}), style: swapped ? { flexBasis: size } : {}, children:
|
|
197
|
+
}), style: swapped ? { flexBasis: size } : {}, children: childrenArray[1] }), floating && ((0, jsx_runtime_1.jsx)("div", { ref: (fr) => setFloatingResizer(fr), className: (0, classnames_1.default)(Splitter_module_scss_1.default.floatingResizer, {
|
|
172
198
|
[Splitter_module_scss_1.default.horizontal]: orientation === "horizontal",
|
|
173
199
|
[Splitter_module_scss_1.default.vertical]: orientation === "vertical",
|
|
174
200
|
}), style: {
|
|
175
201
|
top: orientation === "horizontal" ? 0 : size,
|
|
176
202
|
left: orientation === "horizontal" ? size : 0,
|
|
177
|
-
}, children: splitterTemplate }))] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (
|
|
203
|
+
}, children: splitterTemplate }))] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray[0]) && ((0, jsx_runtime_1.jsx)("div", { className: Splitter_module_scss_1.default.panel, children: childrenArray[0] })) })) })));
|
|
178
204
|
};
|
|
179
205
|
exports.Splitter = Splitter;
|
|
@@ -3,10 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toPercentage = exports.parseSize = void 0;
|
|
4
4
|
const parseSize = (size, containerSize) => {
|
|
5
5
|
if (size.endsWith('px')) {
|
|
6
|
-
|
|
6
|
+
const pixels = parseInt(size, 10);
|
|
7
|
+
// If negative, calculate from the end: containerSize - abs(pixels)
|
|
8
|
+
return pixels < 0 ? containerSize + pixels : pixels;
|
|
7
9
|
}
|
|
8
10
|
else if (size.endsWith('%')) {
|
|
9
|
-
|
|
11
|
+
const percentage = parseInt(size, 10);
|
|
12
|
+
// If negative, calculate from the end: 100% - abs(percentage)
|
|
13
|
+
const actualPercentage = percentage < 0 ? 100 + percentage : percentage;
|
|
14
|
+
return (actualPercentage / 100) * containerSize;
|
|
10
15
|
}
|
|
11
16
|
throw new Error('Invalid size format. Use px or %.');
|
|
12
17
|
};
|
|
@@ -55,12 +55,12 @@ exports.SwitchMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
55
55
|
themeVars: (0, themeVars_1.parseScssVar)(Toggle_module_scss_1.default.themeVars),
|
|
56
56
|
limitThemeVarsToComponent: true,
|
|
57
57
|
defaultThemeVars: {
|
|
58
|
-
[`borderColor-checked-${COMP}
|
|
59
|
-
[`backgroundColor-checked-${COMP}
|
|
60
|
-
[`borderColor-checked-${COMP}
|
|
61
|
-
[`backgroundColor-checked-${COMP}
|
|
62
|
-
[`borderColor-checked-${COMP}
|
|
63
|
-
[`backgroundColor-checked-${COMP}
|
|
58
|
+
[`borderColor-checked-${COMP}--error`]: `$borderColor-${COMP}--error`,
|
|
59
|
+
[`backgroundColor-checked-${COMP}--error`]: `$borderColor-${COMP}--error`,
|
|
60
|
+
[`borderColor-checked-${COMP}--warning`]: `$borderColor-${COMP}--warning`,
|
|
61
|
+
[`backgroundColor-checked-${COMP}--warning`]: `$borderColor-${COMP}--warning`,
|
|
62
|
+
[`borderColor-checked-${COMP}--success`]: `$borderColor-${COMP}--success`,
|
|
63
|
+
[`backgroundColor-checked-${COMP}--success`]: `$borderColor-${COMP}--success`,
|
|
64
64
|
[`backgroundColor-${COMP}`]: "$color-surface-0",
|
|
65
65
|
[`borderColor-${COMP}`]: "$color-surface-200",
|
|
66
66
|
[`borderWidth-${COMP}`]: "1px",
|
|
@@ -689,33 +689,6 @@ fixtures_1.test.describe("Theme Vars", () => {
|
|
|
689
689
|
const driver = yield createCheckboxDriver();
|
|
690
690
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(128, 128, 128)");
|
|
691
691
|
}));
|
|
692
|
-
(0, fixtures_1.test)("valid borderColor", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
|
|
693
|
-
yield initTestBed(`<Switch validationStatus="valid" />`, {
|
|
694
|
-
testThemeVars: {
|
|
695
|
-
"borderColor-checked-Switch-success": "rgb(0, 255, 0)",
|
|
696
|
-
},
|
|
697
|
-
});
|
|
698
|
-
const driver = yield createCheckboxDriver();
|
|
699
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
700
|
-
}));
|
|
701
|
-
(0, fixtures_1.test)("warning borderColor", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
|
|
702
|
-
yield initTestBed(`<Switch validationStatus="warning" />`, {
|
|
703
|
-
testThemeVars: {
|
|
704
|
-
"borderColor-checked-Switch-warning": "rgb(255, 165, 0)",
|
|
705
|
-
},
|
|
706
|
-
});
|
|
707
|
-
const driver = yield createCheckboxDriver();
|
|
708
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
709
|
-
}));
|
|
710
|
-
(0, fixtures_1.test)("error borderColor", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
|
|
711
|
-
yield initTestBed(`<Switch validationStatus="error" />`, {
|
|
712
|
-
testThemeVars: {
|
|
713
|
-
"borderColor-checked-Switch-error": "rgb(255, 0, 0)",
|
|
714
|
-
},
|
|
715
|
-
});
|
|
716
|
-
const driver = yield createCheckboxDriver();
|
|
717
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
718
|
-
}));
|
|
719
692
|
(0, fixtures_1.test)("outlineWidth on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver }) {
|
|
720
693
|
yield initTestBed(`<Switch />`, {
|
|
721
694
|
testThemeVars: {
|
|
@@ -738,29 +711,54 @@ fixtures_1.test.describe("Theme Vars", () => {
|
|
|
738
711
|
}));
|
|
739
712
|
});
|
|
740
713
|
// =============================================================================
|
|
741
|
-
// VALIDATION
|
|
714
|
+
// VALIDATION TESTS
|
|
742
715
|
// =============================================================================
|
|
743
716
|
fixtures_1.test.describe("Validation", () => {
|
|
744
|
-
(0, fixtures_1.test)(
|
|
745
|
-
yield initTestBed(`<Switch
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
yield
|
|
751
|
-
const driver = yield createCheckboxDriver();
|
|
752
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveClass(/warning/);
|
|
753
|
-
}));
|
|
754
|
-
(0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createCheckboxDriver, }) {
|
|
755
|
-
yield initTestBed(`<Switch validationStatus="valid" />`);
|
|
756
|
-
const driver = yield createCheckboxDriver();
|
|
757
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveClass(/valid/);
|
|
717
|
+
(0, fixtures_1.test)(`applies correct borderColor --default`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
718
|
+
yield initTestBed(`<Switch testId="test" />`, {
|
|
719
|
+
testThemeVars: {
|
|
720
|
+
"borderColor-Switch": "rgb(255, 0, 0)",
|
|
721
|
+
},
|
|
722
|
+
});
|
|
723
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
758
724
|
}));
|
|
759
|
-
(0, fixtures_1.test)(
|
|
760
|
-
yield initTestBed(`<Switch
|
|
761
|
-
|
|
762
|
-
|
|
725
|
+
(0, fixtures_1.test)(`applies correct backgroundColor when checked --default`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
726
|
+
yield initTestBed(`<Switch testId="test" initialValue="true" />`, {
|
|
727
|
+
testThemeVars: {
|
|
728
|
+
"backgroundColor-checked-Switch": "rgb(240, 240, 240)",
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
763
732
|
}));
|
|
733
|
+
(0, fixtures_1.test)(`applies correct borderColor on hover`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
734
|
+
yield initTestBed(`<Switch testId="test" />`, {
|
|
735
|
+
testThemeVars: { [`borderColor-Switch--default--hover`]: "rgb(0, 0, 0)" },
|
|
736
|
+
});
|
|
737
|
+
yield page.getByTestId("test").hover();
|
|
738
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
739
|
+
}));
|
|
740
|
+
[
|
|
741
|
+
{ value: "--warning", prop: 'validationStatus="warning"' },
|
|
742
|
+
{ value: "--error", prop: 'validationStatus="error"' },
|
|
743
|
+
{ value: "--success", prop: 'validationStatus="valid"' },
|
|
744
|
+
].forEach((variant) => {
|
|
745
|
+
(0, fixtures_1.test)(`applies correct borderColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
746
|
+
yield initTestBed(`<Switch testId="test" ${variant.prop} />`, {
|
|
747
|
+
testThemeVars: {
|
|
748
|
+
[`borderColor-Switch${variant.value === "--default" ? "" : variant.value}`]: "rgb(255, 0, 0)",
|
|
749
|
+
},
|
|
750
|
+
});
|
|
751
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
752
|
+
}));
|
|
753
|
+
(0, fixtures_1.test)(`applies correct backgroundColor when checked ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
754
|
+
yield initTestBed(`<Switch testId="test" initialValue="true" ${variant.prop} />`, {
|
|
755
|
+
testThemeVars: {
|
|
756
|
+
[`backgroundColor-checked-Switch${variant.value === "--default" ? "" : variant.value}`]: "rgb(240, 240, 240)",
|
|
757
|
+
},
|
|
758
|
+
});
|
|
759
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
760
|
+
}));
|
|
761
|
+
});
|
|
764
762
|
});
|
|
765
763
|
// =============================================================================
|
|
766
764
|
// EDGE CASE TESTS
|
|
@@ -107,15 +107,20 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
107
107
|
[`borderStyle-${COMP}`]: "solid",
|
|
108
108
|
[`fontSize-${COMP}`]: "$fontSize-sm",
|
|
109
109
|
[`borderWidth-${COMP}`]: "$space-0",
|
|
110
|
-
[`lineHeight-${COMP}-codefence`]: "1.5",
|
|
111
|
-
[`fontWeight-${COMP}-abbr`]: "$fontWeight-bold",
|
|
112
|
-
[`textTransform-${COMP}-abbr`]: "uppercase",
|
|
113
|
-
[`fontSize-${COMP}-secondary`]: "$fontSize-sm",
|
|
114
|
-
[`fontStyle-${COMP}-cite`]: "italic",
|
|
115
110
|
[`textColor-${COMP}`]: "$textColor-primary",
|
|
116
111
|
[`fontFamily-${COMP}`]: "$fontFamily",
|
|
117
112
|
[`fontWeight-${COMP}`]: "$fontWeight-normal",
|
|
113
|
+
[`fontSize-${COMP}-secondary`]: "$fontSize-sm",
|
|
114
|
+
[`textColor-${COMP}-secondary`]: "$textColor-secondary",
|
|
115
|
+
[`fontWeight-${COMP}-abbr`]: "$fontWeight-bold",
|
|
116
|
+
[`textTransform-${COMP}-abbr`]: "uppercase",
|
|
117
|
+
[`fontStyle-${COMP}-cite`]: "italic",
|
|
118
118
|
[`fontSize-${COMP}-codefence`]: "$fontSize-code",
|
|
119
|
+
[`fontFamily-${COMP}-codefence`]: "$fontFamily-monospace",
|
|
120
|
+
[`paddingHorizontal-${COMP}-codefence`]: "$space-4",
|
|
121
|
+
[`paddingVertical-${COMP}-codefence`]: "$space-3",
|
|
122
|
+
[`textColor-${COMP}-codefence`]: "$color-surface-900",
|
|
123
|
+
[`lineHeight-${COMP}-codefence`]: "1.5",
|
|
119
124
|
[`fontFamily-${COMP}-code`]: "$fontFamily-monospace",
|
|
120
125
|
[`fontSize-${COMP}-code`]: "$fontSize-sm",
|
|
121
126
|
[`borderWidth-${COMP}-code`]: "1px",
|
|
@@ -123,6 +128,8 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
123
128
|
[`borderRadius-${COMP}-code`]: "4px",
|
|
124
129
|
[`paddingHorizontal-${COMP}-code`]: "$space-0_5",
|
|
125
130
|
[`paddingBottom-${COMP}-code`]: "2px",
|
|
131
|
+
[`backgroundColor-${COMP}-code`]: "rgb(from $color-surface-100 r g b / 0.4)",
|
|
132
|
+
[`borderColor-${COMP}-code`]: "$color-surface-100",
|
|
126
133
|
[`textDecorationLine-${COMP}-deleted`]: "line-through",
|
|
127
134
|
[`textDecorationLine-${COMP}-inserted`]: "underline",
|
|
128
135
|
[`fontFamily-${COMP}-keyboard`]: "$fontFamily-monospace",
|
|
@@ -130,6 +137,8 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
130
137
|
[`fontWeight-${COMP}-keyboard`]: "$fontWeight-bold",
|
|
131
138
|
[`borderWidth-${COMP}-keyboard`]: "1px",
|
|
132
139
|
[`paddingHorizontal-${COMP}-keyboard`]: "$space-1",
|
|
140
|
+
[`backgroundColor-${COMP}-keyboard`]: "rgb(from $color-surface-100 r g b / 0.4)",
|
|
141
|
+
[`borderColor-${COMP}-keyboard`]: "$color-surface-300",
|
|
133
142
|
[`fontFamily-${COMP}-sample`]: "$fontFamily-monospace",
|
|
134
143
|
[`fontSize-${COMP}-sample`]: "$fontSize-sm",
|
|
135
144
|
[`fontSize-${COMP}-sup`]: "$fontSize-xs",
|
|
@@ -144,28 +153,20 @@ exports.TextMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
144
153
|
[`fontSize-${COMP}-small`]: "$fontSize-sm",
|
|
145
154
|
[`letterSpacing-${COMP}-caption`]: "0.05rem",
|
|
146
155
|
[`fontSize-${COMP}-placeholder`]: "$fontSize-xs",
|
|
147
|
-
[`
|
|
148
|
-
[`paddingHorizontal-${COMP}-codefence`]: "$space-4",
|
|
149
|
-
[`paddingVertical-${COMP}-codefence`]: "$space-3",
|
|
156
|
+
[`textColor-${COMP}-placeholder`]: "$color-surface-500",
|
|
150
157
|
[`paddingVertical-${COMP}-paragraph`]: "$space-1",
|
|
151
158
|
[`fontSize-${COMP}-subheading`]: "$fontSize-H6",
|
|
152
159
|
[`fontWeight-${COMP}-subheading`]: "$fontWeight-bold",
|
|
153
160
|
[`letterSpacing-${COMP}-subheading`]: "0.04em",
|
|
154
161
|
[`textTransform-${COMP}-subheading`]: "uppercase",
|
|
162
|
+
[`textColor-${COMP}-subheading`]: "$textColor-secondary",
|
|
155
163
|
[`marginTop-${COMP}-tableheading`]: "$space-1",
|
|
156
164
|
[`marginBottom-${COMP}-tableheading`]: "$space-4",
|
|
157
165
|
[`paddingHorizontal-${COMP}-tableheading`]: "$space-1",
|
|
158
166
|
[`fontSize-${COMP}-tableheading`]: "$fontSize-H6",
|
|
159
167
|
[`fontWeight-${COMP}-tableheading`]: "$fontWeight-bold",
|
|
160
|
-
[`
|
|
161
|
-
[`borderColor-${COMP}-code`]: "$color-surface-100",
|
|
162
|
-
[`backgroundColor-${COMP}-keyboard`]: "rgb(from $color-surface-100 r g b / 0.4)",
|
|
163
|
-
[`borderColor-${COMP}-keyboard`]: "$color-surface-300",
|
|
168
|
+
[`fontWeight-${COMP}-strong`]: "$fontWeight-bold",
|
|
164
169
|
[`backgroundColor-${COMP}-marked`]: "rgb(from $color-primary-200 r g b / 0.4)",
|
|
165
|
-
[`textColor-${COMP}-placeholder`]: "$color-surface-500",
|
|
166
|
-
[`textColor-${COMP}-codefence`]: "$color-surface-900",
|
|
167
|
-
[`textColor-${COMP}-subheading`]: "$textColor-secondary",
|
|
168
|
-
[`textColor-${COMP}-secondary`]: "$textColor-secondary",
|
|
169
170
|
dark: {
|
|
170
171
|
[`backgroundColor-${COMP}-marked`]: "rgb(from $color-primary-400 r g b / 0.4)",
|
|
171
172
|
},
|
|
@@ -1061,6 +1061,290 @@ fixtures_1.test.describe("Theme Variables", () => {
|
|
|
1061
1061
|
const component = (yield createTextDriver()).component;
|
|
1062
1062
|
yield (0, fixtures_1.expect)(component).toHaveCSS("line-break", EXPECTED);
|
|
1063
1063
|
}));
|
|
1064
|
+
// =============================================================================
|
|
1065
|
+
// PREDEFINED VARIANT TESTS
|
|
1066
|
+
// =============================================================================
|
|
1067
|
+
(0, fixtures_1.test)("variant='secondary' applies secondary theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextDriver, }) {
|
|
1068
|
+
yield initTestBed(`
|
|
1069
|
+
<Theme fontSize-Text-secondary="14px" textColor-Text-secondary="rgb(100, 100, 100)">
|
|
1070
|
+
<Text variant="secondary" testId="text">Secondary text</Text>
|
|
1071
|
+
</Theme>
|
|
1072
|
+
`);
|
|
1073
|
+
const component = (yield createTextDriver("text")).component;
|
|
1074
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "14px");
|
|
1075
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("color", "rgb(100, 100, 100)");
|
|
1076
|
+
}));
|
|
1077
|
+
(0, fixtures_1.test)("variant='abbr' applies abbreviation theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1078
|
+
yield initTestBed(`
|
|
1079
|
+
<Theme fontWeight-Text-abbr="700" textTransform-Text-abbr="uppercase">
|
|
1080
|
+
<Text variant="abbr" testId="text">HTML</Text>
|
|
1081
|
+
</Theme>
|
|
1082
|
+
`);
|
|
1083
|
+
const component = page.getByTestId("text");
|
|
1084
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-weight", "700");
|
|
1085
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("text-transform", "uppercase");
|
|
1086
|
+
}));
|
|
1087
|
+
(0, fixtures_1.test)("variant='cite' applies citation theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1088
|
+
yield initTestBed(`
|
|
1089
|
+
<Theme fontStyle-Text-cite="italic">
|
|
1090
|
+
<Text variant="cite" testId="text">Citation</Text>
|
|
1091
|
+
</Theme>
|
|
1092
|
+
`);
|
|
1093
|
+
const component = page.getByTestId("text");
|
|
1094
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-style", "italic");
|
|
1095
|
+
}));
|
|
1096
|
+
(0, fixtures_1.test)("variant='code' applies inline code theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1097
|
+
yield initTestBed(`
|
|
1098
|
+
<Theme
|
|
1099
|
+
fontFamily-Text-code="monospace"
|
|
1100
|
+
fontSize-Text-code="14px"
|
|
1101
|
+
borderWidth-Text-code="1px"
|
|
1102
|
+
borderStyle-Text-code="solid"
|
|
1103
|
+
borderRadius-Text-code="4px"
|
|
1104
|
+
paddingHorizontal-Text-code="4px"
|
|
1105
|
+
paddingBottom-Text-code="2px"
|
|
1106
|
+
backgroundColor-Text-code="rgb(240, 240, 240)"
|
|
1107
|
+
borderColor-Text-code="rgb(200, 200, 200)"
|
|
1108
|
+
>
|
|
1109
|
+
<Text variant="code" testId="text">code</Text>
|
|
1110
|
+
</Theme>
|
|
1111
|
+
`);
|
|
1112
|
+
const component = page.getByTestId("text");
|
|
1113
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-family", "monospace");
|
|
1114
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "14px");
|
|
1115
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-width", "1px");
|
|
1116
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-style", "solid");
|
|
1117
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-radius", "4px");
|
|
1118
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-left", "4px");
|
|
1119
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-right", "4px");
|
|
1120
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-bottom", "2px");
|
|
1121
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
1122
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-color", "rgb(200, 200, 200)");
|
|
1123
|
+
}));
|
|
1124
|
+
(0, fixtures_1.test)("variant='deleted' applies deleted text theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1125
|
+
yield initTestBed(`
|
|
1126
|
+
<Theme textDecorationLine-Text-deleted="line-through">
|
|
1127
|
+
<Text variant="deleted" testId="text">Deleted text</Text>
|
|
1128
|
+
</Theme>
|
|
1129
|
+
`);
|
|
1130
|
+
const component = page.getByTestId("text");
|
|
1131
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("text-decoration-line", "line-through");
|
|
1132
|
+
}));
|
|
1133
|
+
(0, fixtures_1.test)("variant='inserted' applies inserted text theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1134
|
+
yield initTestBed(`
|
|
1135
|
+
<Theme textDecorationLine-Text-inserted="underline">
|
|
1136
|
+
<Text variant="inserted" testId="text">Inserted text</Text>
|
|
1137
|
+
</Theme>
|
|
1138
|
+
`);
|
|
1139
|
+
const component = page.getByTestId("text");
|
|
1140
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("text-decoration-line", "underline");
|
|
1141
|
+
}));
|
|
1142
|
+
(0, fixtures_1.test)("variant='keyboard' applies keyboard theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1143
|
+
yield initTestBed(`
|
|
1144
|
+
<Theme
|
|
1145
|
+
fontFamily-Text-keyboard="monospace"
|
|
1146
|
+
fontSize-Text-keyboard="14px"
|
|
1147
|
+
fontWeight-Text-keyboard="700"
|
|
1148
|
+
borderWidth-Text-keyboard="1px"
|
|
1149
|
+
paddingHorizontal-Text-keyboard="4px"
|
|
1150
|
+
backgroundColor-Text-keyboard="rgb(245, 245, 245)"
|
|
1151
|
+
borderColor-Text-keyboard="rgb(180, 180, 180)"
|
|
1152
|
+
>
|
|
1153
|
+
<Text variant="keyboard" testId="text">Ctrl+C</Text>
|
|
1154
|
+
</Theme>
|
|
1155
|
+
`);
|
|
1156
|
+
const component = page.getByTestId("text");
|
|
1157
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-family", "monospace");
|
|
1158
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "14px");
|
|
1159
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-weight", "700");
|
|
1160
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-width", "1px");
|
|
1161
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-left", "4px");
|
|
1162
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-right", "4px");
|
|
1163
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("background-color", "rgb(245, 245, 245)");
|
|
1164
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("border-color", "rgb(180, 180, 180)");
|
|
1165
|
+
}));
|
|
1166
|
+
(0, fixtures_1.test)("variant='sample' applies sample theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1167
|
+
yield initTestBed(`
|
|
1168
|
+
<Theme
|
|
1169
|
+
fontFamily-Text-sample="monospace"
|
|
1170
|
+
fontSize-Text-sample="14px"
|
|
1171
|
+
>
|
|
1172
|
+
<Text variant="sample" testId="text">Sample output</Text>
|
|
1173
|
+
</Theme>
|
|
1174
|
+
`);
|
|
1175
|
+
const component = page.getByTestId("text");
|
|
1176
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-family", "monospace");
|
|
1177
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "14px");
|
|
1178
|
+
}));
|
|
1179
|
+
(0, fixtures_1.test)("variant='sup' applies superscript theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1180
|
+
yield initTestBed(`
|
|
1181
|
+
<Theme
|
|
1182
|
+
fontSize-Text-sup="12px"
|
|
1183
|
+
verticalAlignment-Text-sup="super"
|
|
1184
|
+
>
|
|
1185
|
+
<Text variant="sup" testId="text">2</Text>
|
|
1186
|
+
</Theme>
|
|
1187
|
+
`);
|
|
1188
|
+
const component = page.getByTestId("text");
|
|
1189
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "12px");
|
|
1190
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("vertical-align", "super");
|
|
1191
|
+
}));
|
|
1192
|
+
(0, fixtures_1.test)("variant='sub' applies subscript theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1193
|
+
yield initTestBed(`
|
|
1194
|
+
<Theme
|
|
1195
|
+
fontSize-Text-sub="12px"
|
|
1196
|
+
verticalAlignment-Text-sub="sub"
|
|
1197
|
+
>
|
|
1198
|
+
<Text variant="sub" testId="text">2</Text>
|
|
1199
|
+
</Theme>
|
|
1200
|
+
`);
|
|
1201
|
+
const component = page.getByTestId("text");
|
|
1202
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "12px");
|
|
1203
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("vertical-align", "sub");
|
|
1204
|
+
}));
|
|
1205
|
+
(0, fixtures_1.test)("variant='var' applies variable theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1206
|
+
yield initTestBed(`
|
|
1207
|
+
<Theme fontStyle-Text-var="italic">
|
|
1208
|
+
<Text variant="var" testId="text">variable</Text>
|
|
1209
|
+
</Theme>
|
|
1210
|
+
`);
|
|
1211
|
+
const component = page.getByTestId("text");
|
|
1212
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-style", "italic");
|
|
1213
|
+
}));
|
|
1214
|
+
(0, fixtures_1.test)("variant='em' applies emphasis theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1215
|
+
yield initTestBed(`
|
|
1216
|
+
<Theme fontStyle-Text-em="italic">
|
|
1217
|
+
<Text variant="em" testId="text">Emphasized</Text>
|
|
1218
|
+
</Theme>
|
|
1219
|
+
`);
|
|
1220
|
+
const component = page.getByTestId("text");
|
|
1221
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-style", "italic");
|
|
1222
|
+
}));
|
|
1223
|
+
(0, fixtures_1.test)("variant='mono' applies monospace theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1224
|
+
yield initTestBed(`
|
|
1225
|
+
<Theme fontFamily-Text-mono="monospace">
|
|
1226
|
+
<Text variant="mono" testId="text">Monospace text</Text>
|
|
1227
|
+
</Theme>
|
|
1228
|
+
`);
|
|
1229
|
+
const component = page.getByTestId("text");
|
|
1230
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-family", "monospace");
|
|
1231
|
+
}));
|
|
1232
|
+
(0, fixtures_1.test)("variant='title' applies title theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1233
|
+
yield initTestBed(`
|
|
1234
|
+
<Theme fontSize-Text-title="32px">
|
|
1235
|
+
<Text variant="title" testId="text">Main Title</Text>
|
|
1236
|
+
</Theme>
|
|
1237
|
+
`);
|
|
1238
|
+
const component = page.getByTestId("text");
|
|
1239
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "32px");
|
|
1240
|
+
}));
|
|
1241
|
+
(0, fixtures_1.test)("variant='subtitle' applies subtitle theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1242
|
+
yield initTestBed(`
|
|
1243
|
+
<Theme fontSize-Text-subtitle="24px">
|
|
1244
|
+
<Text variant="subtitle" testId="text">Subtitle</Text>
|
|
1245
|
+
</Theme>
|
|
1246
|
+
`);
|
|
1247
|
+
const component = page.getByTestId("text");
|
|
1248
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "24px");
|
|
1249
|
+
}));
|
|
1250
|
+
(0, fixtures_1.test)("variant='small' applies small text theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1251
|
+
yield initTestBed(`
|
|
1252
|
+
<Theme fontSize-Text-small="14px">
|
|
1253
|
+
<Text variant="small" testId="text">Small text</Text>
|
|
1254
|
+
</Theme>
|
|
1255
|
+
`);
|
|
1256
|
+
const component = page.getByTestId("text");
|
|
1257
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "14px");
|
|
1258
|
+
}));
|
|
1259
|
+
(0, fixtures_1.test)("variant='caption' applies caption theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1260
|
+
yield initTestBed(`
|
|
1261
|
+
<Theme letterSpacing-Text-caption="0.8px">
|
|
1262
|
+
<Text variant="caption" testId="text">Caption text</Text>
|
|
1263
|
+
</Theme>
|
|
1264
|
+
`);
|
|
1265
|
+
const component = page.getByTestId("text");
|
|
1266
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("letter-spacing", "0.8px");
|
|
1267
|
+
}));
|
|
1268
|
+
(0, fixtures_1.test)("variant='placeholder' applies placeholder theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1269
|
+
yield initTestBed(`
|
|
1270
|
+
<Theme
|
|
1271
|
+
fontSize-Text-placeholder="12px"
|
|
1272
|
+
textColor-Text-placeholder="rgb(150, 150, 150)"
|
|
1273
|
+
>
|
|
1274
|
+
<Text variant="placeholder" testId="text">Placeholder text</Text>
|
|
1275
|
+
</Theme>
|
|
1276
|
+
`);
|
|
1277
|
+
const component = page.getByTestId("text");
|
|
1278
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "12px");
|
|
1279
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("color", "rgb(150, 150, 150)");
|
|
1280
|
+
}));
|
|
1281
|
+
(0, fixtures_1.test)("variant='paragraph' applies paragraph theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1282
|
+
yield initTestBed(`
|
|
1283
|
+
<Theme paddingVertical-Text-paragraph="4px">
|
|
1284
|
+
<Text variant="paragraph" testId="text">Paragraph text</Text>
|
|
1285
|
+
</Theme>
|
|
1286
|
+
`);
|
|
1287
|
+
const component = page.getByTestId("text");
|
|
1288
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-top", "4px");
|
|
1289
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-bottom", "4px");
|
|
1290
|
+
}));
|
|
1291
|
+
(0, fixtures_1.test)("variant='subheading' applies subheading theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1292
|
+
yield initTestBed(`
|
|
1293
|
+
<Theme
|
|
1294
|
+
fontSize-Text-subheading="18px"
|
|
1295
|
+
fontWeight-Text-subheading="700"
|
|
1296
|
+
letterSpacing-Text-subheading="0.8px"
|
|
1297
|
+
textTransform-Text-subheading="uppercase"
|
|
1298
|
+
textColor-Text-subheading="rgb(80, 80, 80)"
|
|
1299
|
+
>
|
|
1300
|
+
<Text variant="subheading" testId="text">Subheading</Text>
|
|
1301
|
+
</Theme>
|
|
1302
|
+
`);
|
|
1303
|
+
const component = page.getByTestId("text");
|
|
1304
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "18px");
|
|
1305
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-weight", "700");
|
|
1306
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("letter-spacing", "0.8px");
|
|
1307
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("text-transform", "uppercase");
|
|
1308
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("color", "rgb(80, 80, 80)");
|
|
1309
|
+
}));
|
|
1310
|
+
(0, fixtures_1.test)("variant='tableheading' applies table heading theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
1311
|
+
yield initTestBed(`
|
|
1312
|
+
<Theme
|
|
1313
|
+
marginTop-Text-tableheading="4px"
|
|
1314
|
+
marginBottom-Text-tableheading="16px"
|
|
1315
|
+
paddingHorizontal-Text-tableheading="4px"
|
|
1316
|
+
fontSize-Text-tableheading="18px"
|
|
1317
|
+
fontWeight-Text-tableheading="700"
|
|
1318
|
+
>
|
|
1319
|
+
<Text variant="tableheading" testId="text">Table Header</Text>
|
|
1320
|
+
</Theme>
|
|
1321
|
+
`);
|
|
1322
|
+
const component = page.getByTestId("text");
|
|
1323
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("margin-top", "4px");
|
|
1324
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("margin-bottom", "16px");
|
|
1325
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-left", "4px");
|
|
1326
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("padding-right", "4px");
|
|
1327
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-size", "18px");
|
|
1328
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-weight", "700");
|
|
1329
|
+
}));
|
|
1330
|
+
(0, fixtures_1.test)("variant='strong' applies strong theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1331
|
+
yield initTestBed(`
|
|
1332
|
+
<Theme fontWeight-Text-strong="700">
|
|
1333
|
+
<Text variant="strong" testId="text">Strong text</Text>
|
|
1334
|
+
</Theme>
|
|
1335
|
+
`);
|
|
1336
|
+
const component = page.getByTestId("text");
|
|
1337
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("font-weight", "700");
|
|
1338
|
+
}));
|
|
1339
|
+
(0, fixtures_1.test)("variant='marked' applies marked theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
1340
|
+
yield initTestBed(`
|
|
1341
|
+
<Theme backgroundColor-Text-marked="rgb(255, 255, 0)">
|
|
1342
|
+
<Text variant="marked" testId="text">Highlighted text</Text>
|
|
1343
|
+
</Theme>
|
|
1344
|
+
`);
|
|
1345
|
+
const component = page.getByTestId("text");
|
|
1346
|
+
yield (0, fixtures_1.expect)(component).toHaveCSS("background-color", "rgb(255, 255, 0)");
|
|
1347
|
+
}));
|
|
1064
1348
|
});
|
|
1065
1349
|
// =============================================================================
|
|
1066
1350
|
// CUSTOM VARIANT TESTS
|