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
|
@@ -384,8 +384,8 @@ fixtures_1.test.describe("Visual States", () => {
|
|
|
384
384
|
(0, fixtures_1.test)("component applies theme variables correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
385
385
|
yield initTestBed(`<TextArea testId="input" />`, {
|
|
386
386
|
testThemeVars: {
|
|
387
|
-
"backgroundColor-TextArea
|
|
388
|
-
"textColor-TextArea
|
|
387
|
+
"backgroundColor-TextArea--default": "rgb(255, 0, 0)",
|
|
388
|
+
"textColor-TextArea--default": "rgb(0, 255, 0)",
|
|
389
389
|
},
|
|
390
390
|
});
|
|
391
391
|
yield (0, fixtures_1.expect)(page.getByTestId("input")).toHaveCSS("background-color", "rgb(255, 0, 0)");
|
|
@@ -792,3 +792,95 @@ fixtures_1.test.describe("Regression", () => {
|
|
|
792
792
|
const { width } = yield input.boundingBox();
|
|
793
793
|
(0, fixtures_1.expect)(width).toBe(200);
|
|
794
794
|
}));
|
|
795
|
+
// =============================================================================
|
|
796
|
+
// THEME VARIABLE TESTS
|
|
797
|
+
// =============================================================================
|
|
798
|
+
fixtures_1.test.describe("Theme Variables", () => {
|
|
799
|
+
[
|
|
800
|
+
{ value: "--default", prop: "" },
|
|
801
|
+
{ value: "--warning", prop: 'validationStatus="warning"' },
|
|
802
|
+
{ value: "--error", prop: 'validationStatus="error"' },
|
|
803
|
+
{ value: "--success", prop: 'validationStatus="valid"' },
|
|
804
|
+
].forEach((variant) => {
|
|
805
|
+
(0, fixtures_1.test)(`applies correct borderRadius ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
806
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
807
|
+
testThemeVars: { [`borderRadius-TextArea${variant.value}`]: "12px" },
|
|
808
|
+
});
|
|
809
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-radius", "12px");
|
|
810
|
+
}));
|
|
811
|
+
(0, fixtures_1.test)(`applies correct borderColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
812
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
813
|
+
testThemeVars: { [`borderColor-TextArea${variant.value}`]: "rgb(255, 0, 0)" },
|
|
814
|
+
});
|
|
815
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
816
|
+
}));
|
|
817
|
+
(0, fixtures_1.test)(`applies correct borderWidth ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
818
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
819
|
+
testThemeVars: { [`borderWidth-TextArea${variant.value}`]: "1px" },
|
|
820
|
+
});
|
|
821
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-width", "1px");
|
|
822
|
+
}));
|
|
823
|
+
(0, fixtures_1.test)(`applies correct borderStyle ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
824
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
825
|
+
testThemeVars: { [`borderStyle-TextArea${variant.value}`]: "dashed" },
|
|
826
|
+
});
|
|
827
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-style", "dashed");
|
|
828
|
+
}));
|
|
829
|
+
(0, fixtures_1.test)(`applies correct fontSize ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
830
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
831
|
+
testThemeVars: { [`fontSize-TextArea${variant.value}`]: "14px" },
|
|
832
|
+
});
|
|
833
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("font-size", "14px");
|
|
834
|
+
}));
|
|
835
|
+
(0, fixtures_1.test)(`applies correct backgroundColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
836
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
837
|
+
testThemeVars: { [`backgroundColor-TextArea${variant.value}`]: "rgb(240, 240, 240)" },
|
|
838
|
+
});
|
|
839
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
840
|
+
}));
|
|
841
|
+
(0, fixtures_1.test)(`applies correct boxShadow ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
842
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
843
|
+
testThemeVars: {
|
|
844
|
+
[`boxShadow-TextArea${variant.value}`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
845
|
+
},
|
|
846
|
+
});
|
|
847
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
848
|
+
}));
|
|
849
|
+
(0, fixtures_1.test)(`applies correct textColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
850
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
851
|
+
testThemeVars: { [`textColor-TextArea${variant.value}`]: "rgb(0, 0, 0)" },
|
|
852
|
+
});
|
|
853
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
854
|
+
}));
|
|
855
|
+
(0, fixtures_1.test)(`applies correct borderColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
856
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
857
|
+
testThemeVars: { [`borderColor-TextArea${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
858
|
+
});
|
|
859
|
+
yield page.getByTestId("test").hover();
|
|
860
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
861
|
+
}));
|
|
862
|
+
(0, fixtures_1.test)(`applies correct backgroundColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
863
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
864
|
+
testThemeVars: { [`backgroundColor-TextArea${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
865
|
+
});
|
|
866
|
+
yield page.getByTestId("test").hover();
|
|
867
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(0, 0, 0)");
|
|
868
|
+
}));
|
|
869
|
+
(0, fixtures_1.test)(`applies correct boxShadow on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
870
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
871
|
+
testThemeVars: {
|
|
872
|
+
[`boxShadow-TextArea${variant.value}--hover`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
873
|
+
},
|
|
874
|
+
});
|
|
875
|
+
yield page.getByTestId("test").hover();
|
|
876
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
877
|
+
}));
|
|
878
|
+
(0, fixtures_1.test)(`applies correct textColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
879
|
+
yield initTestBed(`<TextArea testId="test" ${variant.prop} />`, {
|
|
880
|
+
testThemeVars: { [`textColor-TextArea${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
881
|
+
});
|
|
882
|
+
yield page.getByTestId("test").hover();
|
|
883
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
884
|
+
}));
|
|
885
|
+
});
|
|
886
|
+
});
|
|
@@ -98,9 +98,11 @@ exports.TextBoxMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
98
98
|
"borderStyle-Input": "solid",
|
|
99
99
|
"borderColor-Input--disabled": "$borderColor--disabled",
|
|
100
100
|
"textColor-Input--disabled": "$textColor--disabled",
|
|
101
|
-
"borderColor-Input
|
|
102
|
-
"borderColor-Input
|
|
103
|
-
"borderColor-Input
|
|
101
|
+
"borderColor-Input--default": "$borderColor-Input-default",
|
|
102
|
+
"borderColor-Input--default--hover": "$borderColor-Input-default--hover",
|
|
103
|
+
"borderColor-Input--error": "$borderColor-Input-default--error",
|
|
104
|
+
"borderColor-Input--warning": "$borderColor-Input-default--warning",
|
|
105
|
+
"borderColor-Input--success": "$borderColor-Input-default--success",
|
|
104
106
|
"textColor-placeholder-Input": "$textColor-subtitle",
|
|
105
107
|
"color-adornment-Input": "$textColor-subtitle",
|
|
106
108
|
"outlineColor-Input--focus": "$outlineColor--focus",
|
|
@@ -513,33 +513,6 @@ fixtures_1.test.describe("Theme Vars", () => {
|
|
|
513
513
|
const driver = yield createTextBoxDriver("input");
|
|
514
514
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
515
515
|
}));
|
|
516
|
-
(0, fixtures_1.test)("error borderColor applies with error validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
517
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="error" />`, {
|
|
518
|
-
testThemeVars: {
|
|
519
|
-
"borderColor-TextBox-error": "rgb(255, 0, 0)",
|
|
520
|
-
},
|
|
521
|
-
});
|
|
522
|
-
const driver = yield createTextBoxDriver("input");
|
|
523
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
524
|
-
}));
|
|
525
|
-
(0, fixtures_1.test)("warning borderColor applies with warning validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
526
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="warning" />`, {
|
|
527
|
-
testThemeVars: {
|
|
528
|
-
"borderColor-TextBox-warning": "rgb(255, 165, 0)",
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
const driver = yield createTextBoxDriver("input");
|
|
532
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
533
|
-
}));
|
|
534
|
-
(0, fixtures_1.test)("success borderColor applies with valid validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
535
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="valid" />`, {
|
|
536
|
-
testThemeVars: {
|
|
537
|
-
"borderColor-TextBox-success": "rgb(0, 255, 0)",
|
|
538
|
-
},
|
|
539
|
-
});
|
|
540
|
-
const driver = yield createTextBoxDriver("input");
|
|
541
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
542
|
-
}));
|
|
543
516
|
(0, fixtures_1.test)("borderRadius applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
544
517
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
545
518
|
testThemeVars: {
|
|
@@ -563,40 +536,13 @@ fixtures_1.test.describe("Theme Vars", () => {
|
|
|
563
536
|
// VALIDATION STATUS TESTS
|
|
564
537
|
// =============================================================================
|
|
565
538
|
fixtures_1.test.describe("Validation", () => {
|
|
566
|
-
(0, fixtures_1.test)("validationStatus=error correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
567
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="error" />`, {
|
|
568
|
-
testThemeVars: {
|
|
569
|
-
"borderColor-TextBox-error": "rgb(255, 0, 0)",
|
|
570
|
-
},
|
|
571
|
-
});
|
|
572
|
-
const driver = yield createTextBoxDriver("input");
|
|
573
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
574
|
-
}));
|
|
575
|
-
(0, fixtures_1.test)("validationStatus=warning correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
576
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="warning" />`, {
|
|
577
|
-
testThemeVars: {
|
|
578
|
-
"borderColor-TextBox-warning": "rgb(255, 165, 0)",
|
|
579
|
-
},
|
|
580
|
-
});
|
|
581
|
-
const driver = yield createTextBoxDriver("input");
|
|
582
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
583
|
-
}));
|
|
584
|
-
(0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
585
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="valid" />`, {
|
|
586
|
-
testThemeVars: {
|
|
587
|
-
"borderColor-TextBox-success": "rgb(0, 255, 0)",
|
|
588
|
-
},
|
|
589
|
-
});
|
|
590
|
-
const driver = yield createTextBoxDriver("input");
|
|
591
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
592
|
-
}));
|
|
593
539
|
(0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
594
|
-
yield initTestBed(`<TextBox testId="input" validationStatus="invalid
|
|
540
|
+
yield initTestBed(`<TextBox testId="input" validationStatus="invalid" />`, {
|
|
595
541
|
testThemeVars: {
|
|
596
|
-
"borderColor-TextBox": "rgb(0, 0, 0)",
|
|
597
|
-
"borderColor-TextBox
|
|
598
|
-
"borderColor-TextBox
|
|
599
|
-
"borderColor-TextBox
|
|
542
|
+
"borderColor-TextBox--default": "rgb(0, 0, 0)",
|
|
543
|
+
"borderColor-TextBox--error": "rgb(255, 0, 0)",
|
|
544
|
+
"borderColor-TextBox--warning": "rgb(255, 165, 0)",
|
|
545
|
+
"borderColor-TextBox--success": "rgb(0, 255, 0)",
|
|
600
546
|
},
|
|
601
547
|
});
|
|
602
548
|
const driver = yield createTextBoxDriver("input");
|
|
@@ -605,6 +551,93 @@ fixtures_1.test.describe("Validation", () => {
|
|
|
605
551
|
yield (0, fixtures_1.expect)(driver.component).not.toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
606
552
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
607
553
|
}));
|
|
554
|
+
[
|
|
555
|
+
{ value: "--default", prop: "" },
|
|
556
|
+
{ value: "--warning", prop: 'validationStatus="warning"' },
|
|
557
|
+
{ value: "--error", prop: 'validationStatus="error"' },
|
|
558
|
+
{ value: "--success", prop: 'validationStatus="valid"' },
|
|
559
|
+
].forEach((variant) => {
|
|
560
|
+
(0, fixtures_1.test)(`applies correct borderRadius ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
561
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
562
|
+
testThemeVars: { [`borderRadius-TextBox${variant.value}`]: "12px" },
|
|
563
|
+
});
|
|
564
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-radius", "12px");
|
|
565
|
+
}));
|
|
566
|
+
(0, fixtures_1.test)(`applies correct borderColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
567
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
568
|
+
testThemeVars: { [`borderColor-TextBox${variant.value}`]: "rgb(255, 0, 0)" },
|
|
569
|
+
});
|
|
570
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
571
|
+
}));
|
|
572
|
+
(0, fixtures_1.test)(`applies correct borderWidth ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
573
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
574
|
+
testThemeVars: { [`borderWidth-TextBox${variant.value}`]: "1px" },
|
|
575
|
+
});
|
|
576
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-width", "1px");
|
|
577
|
+
}));
|
|
578
|
+
(0, fixtures_1.test)(`applies correct borderStyle ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
579
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
580
|
+
testThemeVars: { [`borderStyle-TextBox${variant.value}`]: "dashed" },
|
|
581
|
+
});
|
|
582
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-style", "dashed");
|
|
583
|
+
}));
|
|
584
|
+
(0, fixtures_1.test)(`applies correct fontSize ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
585
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
586
|
+
testThemeVars: { [`fontSize-TextBox${variant.value}`]: "14px" },
|
|
587
|
+
});
|
|
588
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("font-size", "14px");
|
|
589
|
+
}));
|
|
590
|
+
(0, fixtures_1.test)(`applies correct backgroundColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
591
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
592
|
+
testThemeVars: { [`backgroundColor-TextBox${variant.value}`]: "rgb(240, 240, 240)" },
|
|
593
|
+
});
|
|
594
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
595
|
+
}));
|
|
596
|
+
(0, fixtures_1.test)(`applies correct boxShadow ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
597
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
598
|
+
testThemeVars: {
|
|
599
|
+
[`boxShadow-TextBox${variant.value}`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
600
|
+
},
|
|
601
|
+
});
|
|
602
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
603
|
+
}));
|
|
604
|
+
(0, fixtures_1.test)(`applies correct textColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
605
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
606
|
+
testThemeVars: { [`textColor-TextBox${variant.value}`]: "rgb(0, 0, 0)" },
|
|
607
|
+
});
|
|
608
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
609
|
+
}));
|
|
610
|
+
(0, fixtures_1.test)(`applies correct borderColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
611
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
612
|
+
testThemeVars: { [`borderColor-TextBox${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
613
|
+
});
|
|
614
|
+
yield page.getByTestId("test").hover();
|
|
615
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
616
|
+
}));
|
|
617
|
+
(0, fixtures_1.test)(`applies correct backgroundColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
618
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
619
|
+
testThemeVars: { [`backgroundColor-TextBox${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
620
|
+
});
|
|
621
|
+
yield page.getByTestId("test").hover();
|
|
622
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(0, 0, 0)");
|
|
623
|
+
}));
|
|
624
|
+
(0, fixtures_1.test)(`applies correct boxShadow on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
625
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
626
|
+
testThemeVars: {
|
|
627
|
+
[`boxShadow-TextBox${variant.value}--hover`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
628
|
+
},
|
|
629
|
+
});
|
|
630
|
+
yield page.getByTestId("test").hover();
|
|
631
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
632
|
+
}));
|
|
633
|
+
(0, fixtures_1.test)(`applies correct textColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
634
|
+
yield initTestBed(`<TextBox testId="test" ${variant.prop} />`, {
|
|
635
|
+
testThemeVars: { [`textColor-TextBox${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
636
|
+
});
|
|
637
|
+
yield page.getByTestId("test").hover();
|
|
638
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
639
|
+
}));
|
|
640
|
+
});
|
|
608
641
|
});
|
|
609
642
|
// =============================================================================
|
|
610
643
|
// EDGE CASE TESTS
|
|
@@ -365,28 +365,6 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
365
365
|
yield (0, fixtures_1.expect)(driver.hourInput).not.toHaveAttribute("required");
|
|
366
366
|
}));
|
|
367
367
|
});
|
|
368
|
-
fixtures_1.test.describe("validationStatus property", () => {
|
|
369
|
-
(0, fixtures_1.test)("displays valid status", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
370
|
-
yield initTestBed(`<TimeInput testId="timeInput" validationStatus="valid" initialValue="14:30" />`);
|
|
371
|
-
const driver = yield createTimeInputDriver("timeInput");
|
|
372
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
373
|
-
}));
|
|
374
|
-
(0, fixtures_1.test)("displays warning status", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
375
|
-
yield initTestBed(`<TimeInput testId="timeInput" validationStatus="warning" initialValue="14:30" />`);
|
|
376
|
-
const driver = yield createTimeInputDriver("timeInput");
|
|
377
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
378
|
-
}));
|
|
379
|
-
(0, fixtures_1.test)("displays error status", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
380
|
-
yield initTestBed(`<TimeInput testId="timeInput" validationStatus="error" initialValue="14:30" />`);
|
|
381
|
-
const driver = yield createTimeInputDriver("timeInput");
|
|
382
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
383
|
-
}));
|
|
384
|
-
(0, fixtures_1.test)("handles null validationStatus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
385
|
-
yield initTestBed(`<TimeInput testId="timeInput" validationStatus="{null}" />`);
|
|
386
|
-
const driver = yield createTimeInputDriver("timeInput");
|
|
387
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
388
|
-
}));
|
|
389
|
-
});
|
|
390
368
|
fixtures_1.test.describe("minTime and maxTime properties", () => {
|
|
391
369
|
(0, fixtures_1.test)("accepts minTime constraint", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
392
370
|
yield initTestBed(`<TimeInput testId="timeInput" minTime="10:00" initialValue="14:30" />`);
|
|
@@ -893,25 +871,123 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
893
871
|
fixtures_1.test.describe("Theme Variables", () => {
|
|
894
872
|
(0, fixtures_1.test)("applies Input borderRadius theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
|
|
895
873
|
yield initTestBed(`<TimeInput testId="time-input" />`, {
|
|
896
|
-
testThemeVars: { "borderRadius-TimeInput
|
|
874
|
+
testThemeVars: { "borderRadius-TimeInput--default": "10px" },
|
|
897
875
|
});
|
|
898
876
|
const driver = yield createTimeInputDriver("time-input");
|
|
899
877
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-radius", "10px");
|
|
900
878
|
}));
|
|
901
879
|
(0, fixtures_1.test)("applies Input borderColor theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
|
|
902
880
|
yield initTestBed(`<TimeInput testId="time-input" />`, {
|
|
903
|
-
testThemeVars: { "borderColor-TimeInput
|
|
881
|
+
testThemeVars: { "borderColor-TimeInput--default": "rgb(255, 0, 0)" },
|
|
904
882
|
});
|
|
905
883
|
const driver = yield createTimeInputDriver("time-input");
|
|
906
884
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
907
885
|
}));
|
|
908
886
|
(0, fixtures_1.test)("applies Input textColor theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver }) {
|
|
909
887
|
yield initTestBed(`<TimeInput testId="time-input" />`, {
|
|
910
|
-
testThemeVars: { "textColor-TimeInput
|
|
888
|
+
testThemeVars: { "textColor-TimeInput--default": "rgb(0, 0, 255)" },
|
|
911
889
|
});
|
|
912
890
|
const driver = yield createTimeInputDriver("time-input");
|
|
913
891
|
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("color", "rgb(0, 0, 255)");
|
|
914
892
|
}));
|
|
893
|
+
(0, fixtures_1.test)("handles invalid validationStatus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
894
|
+
yield initTestBed(`<TimeInput testId="timeInput" validationStatus="invalid" />`, {
|
|
895
|
+
testThemeVars: {
|
|
896
|
+
"borderColor-TimeInput--default": "rgb(0, 0, 0)",
|
|
897
|
+
"borderColor-TimeInput--error": "rgb(255, 0, 0)",
|
|
898
|
+
"borderColor-TimeInput--warning": "rgb(255, 165, 0)",
|
|
899
|
+
"borderColor-TimeInput--success": "rgb(0, 255, 0)",
|
|
900
|
+
},
|
|
901
|
+
});
|
|
902
|
+
yield (0, fixtures_1.expect)(page.getByTestId("timeInput")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
903
|
+
}));
|
|
904
|
+
[
|
|
905
|
+
{ value: "--default", prop: "" },
|
|
906
|
+
{ value: "--warning", prop: 'validationStatus="warning"' },
|
|
907
|
+
{ value: "--error", prop: 'validationStatus="error"' },
|
|
908
|
+
{ value: "--success", prop: 'validationStatus="valid"' },
|
|
909
|
+
].forEach((variant) => {
|
|
910
|
+
(0, fixtures_1.test)(`applies correct borderRadius ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
911
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
912
|
+
testThemeVars: { [`borderRadius-TimeInput${variant.value}`]: "12px" },
|
|
913
|
+
});
|
|
914
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-radius", "12px");
|
|
915
|
+
}));
|
|
916
|
+
(0, fixtures_1.test)(`applies correct borderColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
917
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
918
|
+
testThemeVars: { [`borderColor-TimeInput${variant.value}`]: "rgb(255, 0, 0)" },
|
|
919
|
+
});
|
|
920
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
921
|
+
}));
|
|
922
|
+
(0, fixtures_1.test)(`applies correct borderWidth ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
923
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
924
|
+
testThemeVars: { [`borderWidth-TimeInput${variant.value}`]: "1px" },
|
|
925
|
+
});
|
|
926
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-width", "1px");
|
|
927
|
+
}));
|
|
928
|
+
(0, fixtures_1.test)(`applies correct borderStyle ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
929
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
930
|
+
testThemeVars: { [`borderStyle-TimeInput${variant.value}`]: "dashed" },
|
|
931
|
+
});
|
|
932
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-style", "dashed");
|
|
933
|
+
}));
|
|
934
|
+
(0, fixtures_1.test)(`applies correct fontSize ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
935
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
936
|
+
testThemeVars: { [`fontSize-TimeInput${variant.value}`]: "14px" },
|
|
937
|
+
});
|
|
938
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("font-size", "14px");
|
|
939
|
+
}));
|
|
940
|
+
(0, fixtures_1.test)(`applies correct backgroundColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
941
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
942
|
+
testThemeVars: { [`backgroundColor-TimeInput${variant.value}`]: "rgb(240, 240, 240)" },
|
|
943
|
+
});
|
|
944
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
945
|
+
}));
|
|
946
|
+
(0, fixtures_1.test)(`applies correct boxShadow ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
947
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
948
|
+
testThemeVars: {
|
|
949
|
+
[`boxShadow-TimeInput${variant.value}`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
950
|
+
},
|
|
951
|
+
});
|
|
952
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
953
|
+
}));
|
|
954
|
+
(0, fixtures_1.test)(`applies correct textColor ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
955
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
956
|
+
testThemeVars: { [`textColor-TimeInput${variant.value}`]: "rgb(0, 0, 0)" },
|
|
957
|
+
});
|
|
958
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
959
|
+
}));
|
|
960
|
+
(0, fixtures_1.test)(`applies correct borderColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
961
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
962
|
+
testThemeVars: { [`borderColor-TimeInput${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
963
|
+
});
|
|
964
|
+
yield page.getByTestId("test").hover();
|
|
965
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
966
|
+
}));
|
|
967
|
+
(0, fixtures_1.test)(`applies correct backgroundColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
968
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
969
|
+
testThemeVars: { [`backgroundColor-TimeInput${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
970
|
+
});
|
|
971
|
+
yield page.getByTestId("test").hover();
|
|
972
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("background-color", "rgb(0, 0, 0)");
|
|
973
|
+
}));
|
|
974
|
+
(0, fixtures_1.test)(`applies correct boxShadow on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
975
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
976
|
+
testThemeVars: {
|
|
977
|
+
[`boxShadow-TimeInput${variant.value}--hover`]: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
978
|
+
},
|
|
979
|
+
});
|
|
980
|
+
yield page.getByTestId("test").hover();
|
|
981
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("box-shadow", "rgba(0, 0, 0, 0.1) 0px 2px 8px 0px");
|
|
982
|
+
}));
|
|
983
|
+
(0, fixtures_1.test)(`applies correct textColor on hover ${variant.value}`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
984
|
+
yield initTestBed(`<TimeInput testId="test" ${variant.prop} />`, {
|
|
985
|
+
testThemeVars: { [`textColor-TimeInput${variant.value}--hover`]: "rgb(0, 0, 0)" },
|
|
986
|
+
});
|
|
987
|
+
yield page.getByTestId("test").hover();
|
|
988
|
+
yield (0, fixtures_1.expect)(page.getByTestId("test")).toHaveCSS("color", "rgb(0, 0, 0)");
|
|
989
|
+
}));
|
|
990
|
+
});
|
|
915
991
|
});
|
|
916
992
|
// =============================================================================
|
|
917
993
|
// OTHER EDGE CASE TESTS
|
|
@@ -9,7 +9,6 @@ const TooltipNative_1 = require("../../components/Tooltip/TooltipNative");
|
|
|
9
9
|
const StyleContext_1 = require("../theming/StyleContext");
|
|
10
10
|
const layout_resolver_1 = require("../theming/layout-resolver");
|
|
11
11
|
const parse_layout_props_1 = require("../theming/parse-layout-props");
|
|
12
|
-
const abstractions_1 = require("../../components/abstractions");
|
|
13
12
|
const BadgeNative_1 = require("../../components/Badge/BadgeNative");
|
|
14
13
|
/**
|
|
15
14
|
* Behavior for applying tooltips to components.
|
|
@@ -107,9 +106,11 @@ exports.variantBehavior = {
|
|
|
107
106
|
}
|
|
108
107
|
// Special handling for Button component
|
|
109
108
|
if (node.type === "Button") {
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
// *** Temporarily disable for Button until we resolve conflicts with existing variants ***
|
|
110
|
+
return false;
|
|
111
|
+
// // For Button, only attach if variant is NOT one of the predefined values
|
|
112
|
+
// const variantStr = typeof variant === "string" ? variant : String(variant);
|
|
113
|
+
// return !buttonVariantValues.includes(variantStr as any);
|
|
113
114
|
}
|
|
114
115
|
// Special handling for Badge component
|
|
115
116
|
if (node.type === "Badge") {
|
|
@@ -6,30 +6,33 @@ exports.insideClosingTag = insideClosingTag;
|
|
|
6
6
|
exports.visitAncestorsInChain = visitAncestorsInChain;
|
|
7
7
|
exports.getFirstNodeFromAncestorChain = getFirstNodeFromAncestorChain;
|
|
8
8
|
exports.getAllRelevantNodesFromAncestorChain = getAllRelevantNodesFromAncestorChain;
|
|
9
|
-
exports.getTriviaNodes = getTriviaNodes;
|
|
10
9
|
const xmlui_parser_1 = require("../../../parsers/xmlui-parser");
|
|
11
10
|
function findTagNameNodeInStack(nodeStack) {
|
|
12
|
-
const elementNode = nodeStack.findLast(n => n.kind === xmlui_parser_1.SyntaxKind.ElementNode);
|
|
11
|
+
const elementNode = nodeStack.findLast((n) => n.kind === xmlui_parser_1.SyntaxKind.ElementNode);
|
|
13
12
|
if (!elementNode) {
|
|
14
13
|
return null;
|
|
15
14
|
}
|
|
16
|
-
const tagNameNode = elementNode.children.find(n => n.kind === xmlui_parser_1.SyntaxKind.TagNameNode);
|
|
15
|
+
const tagNameNode = elementNode.children.find((n) => n.kind === xmlui_parser_1.SyntaxKind.TagNameNode);
|
|
17
16
|
return tagNameNode;
|
|
18
17
|
}
|
|
19
18
|
function compNameForTagNameNode(tagNameNode, getText) {
|
|
20
19
|
const colonIdx = tagNameNode.children.findIndex((n) => n.kind === xmlui_parser_1.SyntaxKind.Colon);
|
|
21
|
-
const hasNs = colonIdx === -1
|
|
20
|
+
const hasNs = colonIdx === -1
|
|
21
|
+
? false
|
|
22
|
+
: tagNameNode
|
|
23
|
+
.children.slice(0, colonIdx)
|
|
24
|
+
.findIndex((n) => n.kind === xmlui_parser_1.SyntaxKind.Identifier) !== -1;
|
|
22
25
|
if (hasNs) {
|
|
23
26
|
return null;
|
|
24
27
|
}
|
|
25
|
-
const nameNode = tagNameNode.children.findLast(c => c.kind === xmlui_parser_1.SyntaxKind.Identifier);
|
|
28
|
+
const nameNode = tagNameNode.children.findLast((c) => c.kind === xmlui_parser_1.SyntaxKind.Identifier);
|
|
26
29
|
return getText(nameNode);
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param pathToElementNode nodes from the inner most node to the closest ElementNode
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
32
|
+
*
|
|
33
|
+
* @param pathToElementNode nodes from the inner most node to the closest ElementNode
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
33
36
|
function insideClosingTag(pathToElementNode) {
|
|
34
37
|
if (pathToElementNode === null) {
|
|
35
38
|
return false;
|
|
@@ -52,11 +55,11 @@ function insideClosingTag(pathToElementNode) {
|
|
|
52
55
|
return false;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
|
-
* Visits ancestors in the chain from the innermost to the outermost node.
|
|
56
|
-
* @param chain The chain of nodes to visit.
|
|
57
|
-
* @param predicate A function that takes a node and returns a boolean.
|
|
58
|
-
* @returns An array of nodes from the innermost to the node that satisfies the predicate, or null if no such node is found.
|
|
59
|
-
*/
|
|
58
|
+
* Visits ancestors in the chain from the innermost to the outermost node.
|
|
59
|
+
* @param chain The chain of nodes to visit.
|
|
60
|
+
* @param predicate A function that takes a node and returns a boolean.
|
|
61
|
+
* @returns An array of nodes from the innermost to the node that satisfies the predicate, or null if no such node is found.
|
|
62
|
+
*/
|
|
60
63
|
function visitAncestorsInChain(chain, predicate) {
|
|
61
64
|
let currentIdx = -1;
|
|
62
65
|
let current = chain.at(currentIdx);
|
|
@@ -101,9 +104,9 @@ function getAllRelevantNodesFromAncestorChain(chain, kind) {
|
|
|
101
104
|
return relevantNodes;
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @param node an ElementNode
|
|
106
|
-
*/
|
|
107
|
+
*
|
|
108
|
+
* @param node an ElementNode
|
|
109
|
+
*/
|
|
107
110
|
function isPairedNode(node) {
|
|
108
111
|
for (const c of node.children) {
|
|
109
112
|
if (c.kind === xmlui_parser_1.SyntaxKind.CloseNodeStart) {
|
|
@@ -116,20 +119,9 @@ function isPairedNode(node) {
|
|
|
116
119
|
return true;
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @param node an ElementNode
|
|
121
|
-
*/
|
|
122
|
+
*
|
|
123
|
+
* @param node an ElementNode
|
|
124
|
+
*/
|
|
122
125
|
function isSelfClosingNode(node) {
|
|
123
126
|
return !isPairedNode(node);
|
|
124
127
|
}
|
|
125
|
-
function getTriviaNodes(node) {
|
|
126
|
-
if (node.pos === node.start) {
|
|
127
|
-
return [];
|
|
128
|
-
}
|
|
129
|
-
else if (node.triviaBefore) {
|
|
130
|
-
return node.triviaBefore;
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
return getTriviaNodes(node.children[0]);
|
|
134
|
-
}
|
|
135
|
-
}
|