xmlui 0.10.14 → 0.10.16
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-779mp2Bm.mjs → index-D4RYJasT.mjs} +2952 -937
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-CAXdczCj.mjs → initMock-qzTZlH-6.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-D90qqMGc.mjs → metadata-utils-CtY0QcvH.mjs} +2 -1
- package/dist/lib/{server-common-lmBDLpUh.mjs → server-common-Cine5nRR.mjs} +1 -1
- package/dist/lib/xmlui-parser.d.ts +1 -1
- package/dist/lib/xmlui.d.ts +87 -11
- package/dist/lib/xmlui.mjs +72 -37
- package/dist/metadata/{collectedComponentMetadata-7DFXlw-J.mjs → collectedComponentMetadata-BQaefK3f.mjs} +3189 -1242
- package/dist/metadata/{initMock-AFWEftc6.mjs → initMock-Cz6QssI3.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +2 -3
- package/dist/scripts/src/components/Animation/AnimationNative.js +5 -1
- package/dist/scripts/src/components/AppState/AppState.js +32 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +27 -3
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -5
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +263 -82
- package/dist/scripts/src/components/Button/Button.js +5 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +41 -2
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +7 -9
- package/dist/scripts/src/components/Form/FormNative.js +33 -25
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Icon/IconNative.js +18 -15
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +182 -123
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +14 -6
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -4
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +112 -423
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +18 -4
- package/dist/scripts/src/components/Option/Option.js +3 -1
- package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
- package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +3 -1
- package/dist/scripts/src/components/Slider/Slider.spec.js +46 -13
- package/dist/scripts/src/components/Slider/SliderNative.js +19 -9
- package/dist/scripts/src/components/Table/Table.js +7 -1
- package/dist/scripts/src/components/Table/TableNative.js +4 -1
- package/dist/scripts/src/components/Table/useRowSelection.js +215 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +1 -5
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +368 -324
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +10 -15
- package/dist/scripts/src/components/Theme/ThemeNative.js +2 -6
- package/dist/scripts/src/components/TimeInput/TimeInput.js +1 -5
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +2 -9
- package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +2932 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +266 -10
- package/dist/scripts/src/components/Tree/TreeNative.js +1048 -23
- package/dist/scripts/src/components/Tree/testData.js +272 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +38 -24
- package/dist/scripts/src/components-core/RestApiProxy.js +0 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +54 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +81 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +1 -0
- package/dist/scripts/src/components-core/parts.js +4 -1
- package/dist/scripts/src/components-core/rendering/AppRoot.js +2 -1
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +32 -48
- package/dist/scripts/src/components-core/rendering/nodeUtils.js +6 -0
- package/dist/scripts/src/components-core/theming/layout-resolver.js +2 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +187 -12
- package/dist/scripts/src/index.js +38 -1
- package/dist/scripts/src/testing/ComponentDrivers.js +77 -31
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +44 -0
- package/dist/scripts/src/testing/drivers/TextBoxDriver.js +20 -0
- package/dist/scripts/src/testing/drivers/TreeDriver.js +13 -0
- package/dist/scripts/src/testing/fixtures.js +40 -9
- package/dist/standalone/xmlui-standalone.es.d.ts +158 -15
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +2 -3
- package/dist/scripts/src/components/Animation/Animation.js +0 -50
|
@@ -15,233 +15,271 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
15
15
|
// BASIC FUNCTIONALITY TESTS
|
|
16
16
|
// =============================================================================
|
|
17
17
|
fixtures_1.test.describe("Basic Functionality", () => {
|
|
18
|
-
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
19
|
-
yield initTestBed(`<TextBox />`);
|
|
20
|
-
yield (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
yield (
|
|
25
|
-
yield (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
yield
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
|
|
18
|
+
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
19
|
+
yield initTestBed(`<TextBox testId="test" />`);
|
|
20
|
+
const driver = yield createTextBoxDriver("test");
|
|
21
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
22
|
+
}));
|
|
23
|
+
(0, fixtures_1.test)("component renders with label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
24
|
+
yield initTestBed(`<TextBox testId="test" label="Username" />`);
|
|
25
|
+
const driver = yield createTextBoxDriver("test");
|
|
26
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
27
|
+
yield (0, fixtures_1.expect)(driver.label).toBeVisible();
|
|
28
|
+
}));
|
|
29
|
+
(0, fixtures_1.test)("initialValue sets field value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
30
|
+
yield initTestBed(`<TextBox testId="test" initialValue="test value" />`);
|
|
31
|
+
const driver = yield createTextBoxDriver("test");
|
|
32
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("test value");
|
|
33
|
+
}));
|
|
34
|
+
(0, fixtures_1.test)("initialValue accepts empty as empty string", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
35
|
+
yield initTestBed(`<TextBox testId="test" initialValue="" />`);
|
|
36
|
+
const driver = yield createTextBoxDriver("test");
|
|
37
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("");
|
|
38
|
+
}));
|
|
39
|
+
(0, fixtures_1.test)("initialValue accepts different data types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
36
40
|
// Test string
|
|
37
|
-
yield initTestBed(`<TextBox initialValue="hello" />`);
|
|
38
|
-
yield (
|
|
41
|
+
yield initTestBed(`<TextBox testId="test" initialValue="hello" />`);
|
|
42
|
+
const driver1 = yield createTextBoxDriver("test");
|
|
43
|
+
yield (0, fixtures_1.expect)(driver1.input).toHaveValue("hello");
|
|
39
44
|
// Test number
|
|
40
|
-
yield initTestBed(`<TextBox initialValue="{123}" />`);
|
|
41
|
-
yield (
|
|
45
|
+
yield initTestBed(`<TextBox testId="test" initialValue="{123}" />`);
|
|
46
|
+
const driver2 = yield createTextBoxDriver("test");
|
|
47
|
+
yield (0, fixtures_1.expect)(driver2.input).toHaveValue("123");
|
|
42
48
|
// Test boolean
|
|
43
|
-
yield initTestBed(`<TextBox initialValue="{true}" />`);
|
|
44
|
-
yield (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
yield (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
yield
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
yield
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
yield (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
yield
|
|
68
|
-
yield (0, fixtures_1.expect)(
|
|
69
|
-
}));
|
|
70
|
-
(0, fixtures_1.test)("
|
|
71
|
-
yield initTestBed(`<TextBox
|
|
72
|
-
yield (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
yield (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
yield (
|
|
82
|
-
yield (
|
|
83
|
-
yield
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
yield
|
|
88
|
-
yield (0, fixtures_1.expect)(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
yield
|
|
92
|
-
yield (0, fixtures_1.expect)(
|
|
93
|
-
}));
|
|
94
|
-
(0, fixtures_1.test)("
|
|
95
|
-
yield initTestBed(`<TextBox
|
|
96
|
-
yield (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
yield
|
|
101
|
-
yield (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
yield (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
49
|
+
yield initTestBed(`<TextBox testId="test" initialValue="{true}" />`);
|
|
50
|
+
const driver3 = yield createTextBoxDriver("test");
|
|
51
|
+
yield (0, fixtures_1.expect)(driver3.input).toHaveValue("true");
|
|
52
|
+
}));
|
|
53
|
+
(0, fixtures_1.test)("initialValue handles null", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
54
|
+
yield initTestBed(`<TextBox testId="test" initialValue="{null}" />`);
|
|
55
|
+
const driver = yield createTextBoxDriver("test");
|
|
56
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("");
|
|
57
|
+
}));
|
|
58
|
+
(0, fixtures_1.test)("initialValue handles undefined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
59
|
+
yield initTestBed(`<TextBox testId="test" initialValue="{undefined}" />`);
|
|
60
|
+
const driver = yield createTextBoxDriver("test");
|
|
61
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("");
|
|
62
|
+
}));
|
|
63
|
+
(0, fixtures_1.test)("component accepts user input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
64
|
+
yield initTestBed(`<TextBox testId="test" />`);
|
|
65
|
+
const driver = yield createTextBoxDriver("test");
|
|
66
|
+
yield driver.input.fill("user input");
|
|
67
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("user input");
|
|
68
|
+
}));
|
|
69
|
+
(0, fixtures_1.test)("component clears input correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
70
|
+
yield initTestBed(`<TextBox testId="test" initialValue="initial text" />`);
|
|
71
|
+
const driver = yield createTextBoxDriver("test");
|
|
72
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("initial text");
|
|
73
|
+
yield driver.input.clear();
|
|
74
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("");
|
|
75
|
+
}));
|
|
76
|
+
(0, fixtures_1.test)("component required prop adds required attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
77
|
+
yield initTestBed(`<TextBox testId="test" required="true" />`);
|
|
78
|
+
const driver = yield createTextBoxDriver("test");
|
|
79
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("required");
|
|
80
|
+
}));
|
|
81
|
+
(0, fixtures_1.test)("enabled=false disables control", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
82
|
+
yield initTestBed(`<TextBox testId="test" enabled="false" />`);
|
|
83
|
+
const driver = yield createTextBoxDriver("test");
|
|
84
|
+
yield (0, fixtures_1.expect)(driver.input).toBeDisabled();
|
|
85
|
+
}));
|
|
86
|
+
(0, fixtures_1.test)("enabled=false prevents user input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
87
|
+
yield initTestBed(`<TextBox testId="test" enabled="false" />`);
|
|
88
|
+
const driver = yield createTextBoxDriver("test");
|
|
89
|
+
yield (0, fixtures_1.expect)(driver.input).not.toBeEditable();
|
|
90
|
+
}));
|
|
91
|
+
(0, fixtures_1.test)("readOnly prevents editing but allows focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
92
|
+
yield initTestBed(`<TextBox testId="test" readOnly="true" initialValue="read only text" />`);
|
|
93
|
+
const driver = yield createTextBoxDriver("test");
|
|
94
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("readonly");
|
|
95
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("read only text");
|
|
96
|
+
yield (0, fixtures_1.expect)(driver.input).not.toBeEditable();
|
|
97
|
+
yield driver.input.focus();
|
|
98
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
99
|
+
}));
|
|
100
|
+
(0, fixtures_1.test)("autoFocus focuses input on mount", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
101
|
+
yield initTestBed(`<TextBox testId="test" autoFocus="true" />`);
|
|
102
|
+
const driver = yield createTextBoxDriver("test");
|
|
103
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
104
|
+
}));
|
|
105
|
+
(0, fixtures_1.test)("autoFocus focuses input on mount with label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
106
|
+
yield initTestBed(`<TextBox testId="test" autoFocus="true" label="Auto-focused input" />`);
|
|
107
|
+
const driver = yield createTextBoxDriver("test");
|
|
108
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
109
|
+
}));
|
|
110
|
+
(0, fixtures_1.test)("placeholder shows when input is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
111
|
+
yield initTestBed(`<TextBox testId="test" placeholder="Enter text here..." />`);
|
|
112
|
+
const driver = yield createTextBoxDriver("test");
|
|
113
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("placeholder", "Enter text here...");
|
|
114
|
+
}));
|
|
115
|
+
(0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
116
|
+
yield initTestBed(`<TextBox testId="test" maxLength="5" />`);
|
|
117
|
+
const driver = yield createTextBoxDriver("test");
|
|
118
|
+
yield driver.input.fill("12345678");
|
|
119
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("12345");
|
|
120
|
+
}));
|
|
121
|
+
(0, fixtures_1.test)("can render startIcon", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
122
|
+
yield initTestBed(`<TextBox testId="test" startIcon="search" />`);
|
|
123
|
+
const driver = yield createTextBoxDriver("test");
|
|
124
|
+
yield (0, fixtures_1.expect)(driver.startAdornment).toBeVisible();
|
|
125
|
+
}));
|
|
126
|
+
(0, fixtures_1.test)("can render endIcon", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
127
|
+
yield initTestBed(`<TextBox testId="test" endIcon="search" />`);
|
|
128
|
+
const driver = yield createTextBoxDriver("test");
|
|
129
|
+
yield (0, fixtures_1.expect)(driver.endAdornment).toBeVisible();
|
|
110
130
|
}));
|
|
111
131
|
});
|
|
112
132
|
// =============================================================================
|
|
113
133
|
// ACCESSIBILITY TESTS
|
|
114
134
|
// =============================================================================
|
|
115
135
|
fixtures_1.test.describe("Accessibility", () => {
|
|
116
|
-
(0, fixtures_1.test)("label is properly associated with input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
117
|
-
yield initTestBed(`<TextBox label="Username" />`);
|
|
118
|
-
yield (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
yield
|
|
123
|
-
yield (
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
(0, fixtures_1.test)("label is properly associated with input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
137
|
+
yield initTestBed(`<TextBox testId="test" label="Username" />`);
|
|
138
|
+
const driver = yield createTextBoxDriver("test");
|
|
139
|
+
yield (0, fixtures_1.expect)(driver.label).toBeVisible();
|
|
140
|
+
}));
|
|
141
|
+
(0, fixtures_1.test)("component supports keyboard navigation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
142
|
+
yield initTestBed(`<TextBox testId="test" label="Input" />`);
|
|
143
|
+
const driver = yield createTextBoxDriver("test");
|
|
144
|
+
yield driver.input.focus();
|
|
145
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
146
|
+
}));
|
|
147
|
+
(0, fixtures_1.test)("component supports keyboard navigation from other elements", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver, }) {
|
|
126
148
|
yield initTestBed(`
|
|
127
149
|
<Fragment>
|
|
128
150
|
<TextBox testId="first-input" label="First input" />
|
|
129
151
|
<TextBox testId="second-input" label="Second input" />
|
|
130
152
|
</Fragment>
|
|
131
153
|
`);
|
|
132
|
-
const firstInput =
|
|
133
|
-
const secondInput =
|
|
134
|
-
yield firstInput.focus();
|
|
135
|
-
yield (0, fixtures_1.expect)(firstInput).toBeFocused();
|
|
154
|
+
const firstInput = yield createTextBoxDriver("first-input");
|
|
155
|
+
const secondInput = yield createTextBoxDriver("second-input");
|
|
156
|
+
yield firstInput.input.focus();
|
|
157
|
+
yield (0, fixtures_1.expect)(firstInput.input).toBeFocused();
|
|
136
158
|
yield page.keyboard.press("Tab", { delay: 100 });
|
|
137
|
-
yield (0, fixtures_1.expect)(secondInput).toBeFocused();
|
|
138
|
-
}));
|
|
139
|
-
(0, fixtures_1.test)("required has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
140
|
-
yield initTestBed(`<TextBox required="true" label="Required input" />`);
|
|
141
|
-
yield (
|
|
142
|
-
yield (0, fixtures_1.expect)(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
yield (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
159
|
+
yield (0, fixtures_1.expect)(secondInput.input).toBeFocused();
|
|
160
|
+
}));
|
|
161
|
+
(0, fixtures_1.test)("required has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
162
|
+
yield initTestBed(`<TextBox testId="test" required="true" label="Required input" />`);
|
|
163
|
+
const driver = yield createTextBoxDriver("test");
|
|
164
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("required");
|
|
165
|
+
yield (0, fixtures_1.expect)(driver.label).toContainText("*");
|
|
166
|
+
}));
|
|
167
|
+
(0, fixtures_1.test)("disabled component has proper attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
168
|
+
yield initTestBed(`<TextBox testId="test" enabled="false" />`);
|
|
169
|
+
const driver = yield createTextBoxDriver("test");
|
|
170
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("disabled");
|
|
171
|
+
}));
|
|
172
|
+
(0, fixtures_1.test)("readOnly has proper ARIA attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
173
|
+
yield initTestBed(`<TextBox testId="test" readOnly="true" label="Read-only input" />`);
|
|
174
|
+
const driver = yield createTextBoxDriver("test");
|
|
175
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("readonly");
|
|
176
|
+
yield (0, fixtures_1.expect)(driver.label).toContainText("Read-only input");
|
|
177
|
+
yield (0, fixtures_1.expect)(driver.input).not.toBeEditable();
|
|
151
178
|
}));
|
|
152
179
|
});
|
|
153
180
|
// =============================================================================
|
|
154
181
|
// LABEL POSITIONING TESTS
|
|
155
182
|
// =============================================================================
|
|
156
183
|
fixtures_1.test.describe("Label", () => {
|
|
157
|
-
(0, fixtures_1.test)("labelPosition=start positions label before input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
158
|
-
yield initTestBed(`<TextBox direction="ltr" label="test" labelPosition="start" />`);
|
|
159
|
-
const
|
|
160
|
-
const {
|
|
184
|
+
(0, fixtures_1.test)("labelPosition=start positions label before input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
185
|
+
yield initTestBed(`<TextBox testId="test" direction="ltr" label="test" labelPosition="start" />`);
|
|
186
|
+
const driver = yield createTextBoxDriver("test");
|
|
187
|
+
const { left: textboxLeft } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
188
|
+
const { right: labelRight } = yield (0, component_test_helpers_1.getBounds)(driver.label);
|
|
161
189
|
(0, fixtures_1.expect)(labelRight).toBeLessThan(textboxLeft);
|
|
162
190
|
}));
|
|
163
|
-
(0, fixtures_1.test)("labelPosition=end positions label after input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
164
|
-
yield initTestBed(`<TextBox direction="ltr" label="test" labelPosition="end" />`);
|
|
165
|
-
const
|
|
166
|
-
const {
|
|
191
|
+
(0, fixtures_1.test)("labelPosition=end positions label after input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
192
|
+
yield initTestBed(`<TextBox testId="test" direction="ltr" label="test" labelPosition="end" />`);
|
|
193
|
+
const driver = yield createTextBoxDriver("test");
|
|
194
|
+
const { right: textboxRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
195
|
+
const { left: labelLeft } = yield (0, component_test_helpers_1.getBounds)(driver.label);
|
|
167
196
|
(0, fixtures_1.expect)(labelLeft).toBeGreaterThan(textboxRight);
|
|
168
197
|
}));
|
|
169
|
-
(0, fixtures_1.test)("labelPosition=top positions label above input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
170
|
-
yield initTestBed(`<TextBox label="test" labelPosition="top" />`);
|
|
171
|
-
const
|
|
172
|
-
const {
|
|
198
|
+
(0, fixtures_1.test)("labelPosition=top positions label above input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
199
|
+
yield initTestBed(`<TextBox testId="test" label="test" labelPosition="top" />`);
|
|
200
|
+
const driver = yield createTextBoxDriver("test");
|
|
201
|
+
const { top: textboxTop } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
202
|
+
const { bottom: labelBottom } = yield (0, component_test_helpers_1.getBounds)(driver.label);
|
|
173
203
|
(0, fixtures_1.expect)(labelBottom).toBeLessThan(textboxTop);
|
|
174
204
|
}));
|
|
175
|
-
(0, fixtures_1.test)("labelPosition=bottom positions label below input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
176
|
-
yield initTestBed(`<TextBox label="test" labelPosition="bottom" />`);
|
|
177
|
-
const
|
|
178
|
-
const {
|
|
205
|
+
(0, fixtures_1.test)("labelPosition=bottom positions label below input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
206
|
+
yield initTestBed(`<TextBox testId="test" label="test" labelPosition="bottom" />`);
|
|
207
|
+
const driver = yield createTextBoxDriver("test");
|
|
208
|
+
const { bottom: textboxBottom } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
209
|
+
const { top: labelTop } = yield (0, component_test_helpers_1.getBounds)(driver.label);
|
|
179
210
|
(0, fixtures_1.expect)(labelTop).toBeGreaterThan(textboxBottom);
|
|
180
211
|
}));
|
|
181
|
-
(0, fixtures_1.test)("labelWidth applies custom label width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
212
|
+
(0, fixtures_1.test)("labelWidth applies custom label width", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
182
213
|
const expected = 200;
|
|
183
|
-
yield initTestBed(`<TextBox label="test test" labelWidth="${expected}px" />`);
|
|
184
|
-
const
|
|
214
|
+
yield initTestBed(`<TextBox testId="test" label="test test" labelWidth="${expected}px" />`);
|
|
215
|
+
const driver = yield createTextBoxDriver("test");
|
|
216
|
+
const { width } = yield (0, component_test_helpers_1.getBounds)(driver.label);
|
|
185
217
|
(0, fixtures_1.expect)(width).toEqual(expected);
|
|
186
218
|
}));
|
|
187
|
-
(0, fixtures_1.test)("labelBreak enables label line breaks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
219
|
+
(0, fixtures_1.test)("labelBreak enables label line breaks", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
188
220
|
const labelText = "Very long label text that should break";
|
|
189
221
|
const commonProps = `label="${labelText}" labelWidth="100px"`;
|
|
190
222
|
yield initTestBed(`<Fragment>
|
|
191
223
|
<TextBox ${commonProps} testId="break" labelBreak="{true}" />
|
|
192
224
|
<TextBox ${commonProps} testId="oneLine" labelBreak="{false}" />
|
|
193
225
|
</Fragment>`);
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
const { height: heightBreak } = yield (0, component_test_helpers_1.getBounds)(
|
|
197
|
-
const { height: heightOneLine } = yield (0, component_test_helpers_1.getBounds)(
|
|
226
|
+
const driverBreak = yield createTextBoxDriver("break");
|
|
227
|
+
const driverOneLine = yield createTextBoxDriver("oneLine");
|
|
228
|
+
const { height: heightBreak } = yield (0, component_test_helpers_1.getBounds)(driverBreak.label);
|
|
229
|
+
const { height: heightOneLine } = yield (0, component_test_helpers_1.getBounds)(driverOneLine.label);
|
|
198
230
|
(0, fixtures_1.expect)(heightBreak).toBeGreaterThan(heightOneLine);
|
|
199
231
|
}));
|
|
200
|
-
(0, fixtures_1.test)("component handles invalid labelPosition gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
201
|
-
yield initTestBed(`<TextBox labelPosition="invalid" label="test" />`);
|
|
202
|
-
yield (
|
|
203
|
-
yield (0, fixtures_1.expect)(
|
|
232
|
+
(0, fixtures_1.test)("component handles invalid labelPosition gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
233
|
+
yield initTestBed(`<TextBox testId="test" labelPosition="invalid" label="test" />`);
|
|
234
|
+
const driver = yield createTextBoxDriver("test");
|
|
235
|
+
yield (0, fixtures_1.expect)(driver.label).toBeVisible();
|
|
236
|
+
yield (0, fixtures_1.expect)(driver.input).toBeVisible();
|
|
204
237
|
}));
|
|
205
238
|
});
|
|
206
239
|
// =============================================================================
|
|
207
240
|
// EVENT HANDLING TESTS
|
|
208
241
|
// =============================================================================
|
|
209
242
|
fixtures_1.test.describe("Event Handling", () => {
|
|
210
|
-
(0, fixtures_1.test)("didChange event fires on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
243
|
+
(0, fixtures_1.test)("didChange event fires on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
211
244
|
const { testStateDriver } = yield initTestBed(`
|
|
212
|
-
<TextBox onDidChange="testState = 'changed'" />
|
|
245
|
+
<TextBox testId="test" onDidChange="testState = 'changed'" />
|
|
213
246
|
`);
|
|
214
|
-
yield
|
|
247
|
+
const driver = yield createTextBoxDriver("test");
|
|
248
|
+
yield driver.input.fill("test");
|
|
215
249
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("changed");
|
|
216
250
|
}));
|
|
217
|
-
(0, fixtures_1.test)("didChange event passes new value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
251
|
+
(0, fixtures_1.test)("didChange event passes new value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
218
252
|
const { testStateDriver } = yield initTestBed(`
|
|
219
|
-
<TextBox onDidChange="arg => testState = arg" />
|
|
253
|
+
<TextBox testId="test" onDidChange="arg => testState = arg" />
|
|
220
254
|
`);
|
|
221
|
-
yield
|
|
255
|
+
const driver = yield createTextBoxDriver("test");
|
|
256
|
+
yield driver.input.fill("test value");
|
|
222
257
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("test value");
|
|
223
258
|
}));
|
|
224
|
-
(0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
259
|
+
(0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
225
260
|
const { testStateDriver } = yield initTestBed(`
|
|
226
|
-
<TextBox onGotFocus="testState = 'focused'" />
|
|
261
|
+
<TextBox testId="test" onGotFocus="testState = 'focused'" />
|
|
227
262
|
`);
|
|
228
|
-
yield
|
|
263
|
+
const driver = yield createTextBoxDriver("test");
|
|
264
|
+
yield driver.input.focus();
|
|
229
265
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
230
266
|
}));
|
|
231
|
-
(0, fixtures_1.test)("component lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
267
|
+
(0, fixtures_1.test)("component lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
232
268
|
const { testStateDriver } = yield initTestBed(`
|
|
233
|
-
<TextBox onLostFocus="testState = 'blurred'" />
|
|
269
|
+
<TextBox testId="test" onLostFocus="testState = 'blurred'" />
|
|
234
270
|
`);
|
|
235
|
-
yield
|
|
236
|
-
yield
|
|
271
|
+
const driver = yield createTextBoxDriver("test");
|
|
272
|
+
yield driver.input.focus();
|
|
273
|
+
yield driver.input.blur();
|
|
237
274
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("blurred");
|
|
238
275
|
}));
|
|
239
|
-
(0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
276
|
+
(0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
240
277
|
const { testStateDriver } = yield initTestBed(`
|
|
241
|
-
<TextBox enabled="false" didChange="testState = 'changed'" gotFocus="testState = 'focused'" />
|
|
278
|
+
<TextBox testId="test" enabled="false" didChange="testState = 'changed'" gotFocus="testState = 'focused'" />
|
|
242
279
|
`);
|
|
243
|
-
yield
|
|
244
|
-
yield
|
|
280
|
+
const driver = yield createTextBoxDriver("test");
|
|
281
|
+
yield driver.input.focus();
|
|
282
|
+
yield driver.input.fill("test", { force: true });
|
|
245
283
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(null);
|
|
246
284
|
}));
|
|
247
285
|
});
|
|
@@ -258,26 +296,28 @@ fixtures_1.test.describe("Api", () => {
|
|
|
258
296
|
`);
|
|
259
297
|
yield (0, fixtures_1.expect)(page.getByTestId("value")).toHaveText("initial");
|
|
260
298
|
}));
|
|
261
|
-
(0, fixtures_1.test)("component value API returns state after change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
299
|
+
(0, fixtures_1.test)("component value API returns state after change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver }) {
|
|
262
300
|
yield initTestBed(`
|
|
263
301
|
<Fragment>
|
|
264
|
-
<TextBox id="myTextBox" />
|
|
302
|
+
<TextBox id="myTextBox" testId="myTextBox" />
|
|
265
303
|
<Text testId="value">{myTextBox.value}</Text>
|
|
266
304
|
</Fragment>
|
|
267
305
|
`);
|
|
306
|
+
const driver = yield createTextBoxDriver("myTextBox");
|
|
268
307
|
yield (0, fixtures_1.expect)(page.getByTestId("value")).toHaveText("");
|
|
269
|
-
yield
|
|
308
|
+
yield driver.input.fill("new value");
|
|
270
309
|
yield (0, fixtures_1.expect)(page.getByTestId("value")).toHaveText("new value");
|
|
271
310
|
}));
|
|
272
|
-
(0, fixtures_1.test)("component setValue API updates state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
311
|
+
(0, fixtures_1.test)("component setValue API updates state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver }) {
|
|
273
312
|
yield initTestBed(`
|
|
274
313
|
<Fragment>
|
|
275
|
-
<TextBox id="myTextBox" />
|
|
314
|
+
<TextBox id="myTextBox" testId="myTextBox" />
|
|
276
315
|
<Button testId="setBtn" onClick="myTextBox.setValue('api value')" />
|
|
277
316
|
</Fragment>
|
|
278
317
|
`);
|
|
318
|
+
const driver = yield createTextBoxDriver("myTextBox");
|
|
279
319
|
yield page.getByTestId("setBtn").click();
|
|
280
|
-
yield (0, fixtures_1.expect)(
|
|
320
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("api value");
|
|
281
321
|
}));
|
|
282
322
|
(0, fixtures_1.test)("component setValue API triggers events", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
283
323
|
const { testStateDriver } = yield initTestBed(`
|
|
@@ -289,103 +329,83 @@ fixtures_1.test.describe("Api", () => {
|
|
|
289
329
|
yield page.getByTestId("setBtn").click();
|
|
290
330
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("api-changed");
|
|
291
331
|
}));
|
|
292
|
-
(0, fixtures_1.test)("focus API focuses the input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
332
|
+
(0, fixtures_1.test)("focus API focuses the input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver }) {
|
|
293
333
|
yield initTestBed(`
|
|
294
334
|
<Fragment>
|
|
295
335
|
<TextBox id="myTextBox" />
|
|
296
336
|
<Button testId="focusBtn" onClick="myTextBox.focus()">Focus</Button>
|
|
297
337
|
</Fragment>
|
|
298
338
|
`);
|
|
299
|
-
const
|
|
300
|
-
yield (0, fixtures_1.expect)(
|
|
339
|
+
const driver = yield createTextBoxDriver("myTextBox");
|
|
340
|
+
yield (0, fixtures_1.expect)(driver.input).not.toBeFocused();
|
|
301
341
|
yield page.getByTestId("focusBtn").click();
|
|
302
|
-
yield (0, fixtures_1.expect)(
|
|
342
|
+
yield (0, fixtures_1.expect)(driver.input).toBeFocused();
|
|
303
343
|
}));
|
|
304
|
-
(0, fixtures_1.test)("focus API does nothing when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
344
|
+
(0, fixtures_1.test)("focus API does nothing when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver }) {
|
|
305
345
|
yield initTestBed(`
|
|
306
346
|
<Fragment>
|
|
307
347
|
<TextBox id="myTextBox" enabled="false" />
|
|
308
348
|
<Button testId="focusBtn" onClick="myTextBox.focus()">Focus</Button>
|
|
309
349
|
</Fragment>
|
|
310
350
|
`);
|
|
351
|
+
const driver = yield createTextBoxDriver("myTextBox");
|
|
311
352
|
yield page.getByTestId("focusBtn").click();
|
|
312
|
-
|
|
313
|
-
yield (0, fixtures_1.expect)(textbox).not.toBeFocused();
|
|
353
|
+
yield (0, fixtures_1.expect)(driver.input).not.toBeFocused();
|
|
314
354
|
}));
|
|
315
355
|
});
|
|
316
356
|
// =============================================================================
|
|
317
357
|
// INPUT ADORNMENTS TESTS
|
|
318
358
|
// =============================================================================
|
|
319
359
|
fixtures_1.test.describe("Input Adornments", () => {
|
|
320
|
-
(0, fixtures_1.test)("startText displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
321
|
-
yield initTestBed(`<TextBox testId="input"
|
|
322
|
-
const
|
|
323
|
-
const { left:
|
|
324
|
-
yield (0,
|
|
360
|
+
(0, fixtures_1.test)("startText displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
361
|
+
yield initTestBed(`<TextBox testId="input" startText="$" />`);
|
|
362
|
+
const driver = yield createTextBoxDriver("input");
|
|
363
|
+
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
364
|
+
const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(driver.startAdornment);
|
|
365
|
+
yield (0, fixtures_1.expect)(driver.startAdornment).toContainText("$");
|
|
325
366
|
(0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
|
|
326
367
|
}));
|
|
327
|
-
(0, fixtures_1.test)("
|
|
328
|
-
yield initTestBed(`<TextBox testId="input"
|
|
329
|
-
const
|
|
330
|
-
const { left:
|
|
331
|
-
yield (0,
|
|
332
|
-
(0, fixtures_1.expect)(
|
|
333
|
-
}));
|
|
334
|
-
(0, fixtures_1.test)("endText displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
335
|
-
yield initTestBed(`<TextBox testId="input" direction="ltr" endText="USD" />`);
|
|
336
|
-
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
|
|
337
|
-
const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(page.getByText("USD"));
|
|
338
|
-
yield (0, fixtures_1.expect)(page.getByTestId("input")).toContainText("USD");
|
|
368
|
+
(0, fixtures_1.test)("endText displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
369
|
+
yield initTestBed(`<TextBox testId="input" endText="USD" />`);
|
|
370
|
+
const driver = yield createTextBoxDriver("input");
|
|
371
|
+
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
372
|
+
const { left: textLeft, right: textRight } = yield (0, component_test_helpers_1.getBounds)(driver.endAdornment);
|
|
373
|
+
yield (0, fixtures_1.expect)(driver.endAdornment).toContainText("USD");
|
|
339
374
|
(0, fixtures_1.expect)(textRight - compLeft).toBeGreaterThanOrEqual(compRight - textLeft);
|
|
340
375
|
}));
|
|
341
|
-
(0, fixtures_1.test)("
|
|
342
|
-
yield initTestBed(`<TextBox testId="input"
|
|
343
|
-
const
|
|
344
|
-
const { left:
|
|
345
|
-
yield (0,
|
|
346
|
-
(0, fixtures_1.expect)(textRight - compLeft).toBeLessThanOrEqual(compRight - textLeft);
|
|
347
|
-
}));
|
|
348
|
-
(0, fixtures_1.test)("startIcon displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
349
|
-
yield initTestBed(`<TextBox testId="input" direction="ltr" startIcon="search" />`);
|
|
350
|
-
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
|
|
351
|
-
const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img"));
|
|
376
|
+
(0, fixtures_1.test)("startIcon displays at beginning of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
377
|
+
yield initTestBed(`<TextBox testId="input" startIcon="search" />`);
|
|
378
|
+
const driver = yield createTextBoxDriver("input");
|
|
379
|
+
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
380
|
+
const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(driver.startAdornment);
|
|
352
381
|
(0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
|
|
353
382
|
}));
|
|
354
|
-
(0, fixtures_1.test)("
|
|
355
|
-
yield initTestBed(`<TextBox testId="input" direction="rtl" startIcon="search" />`);
|
|
356
|
-
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
|
|
357
|
-
const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img"));
|
|
358
|
-
(0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
|
|
359
|
-
}));
|
|
360
|
-
(0, fixtures_1.test)("endIcon displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
383
|
+
(0, fixtures_1.test)("endIcon displays at end of input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
361
384
|
yield initTestBed(`<TextBox testId="input" endIcon="search" />`);
|
|
362
|
-
const
|
|
363
|
-
const { left:
|
|
385
|
+
const driver = yield createTextBoxDriver("input");
|
|
386
|
+
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
387
|
+
const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(driver.endAdornment);
|
|
364
388
|
(0, fixtures_1.expect)(iconRight - compLeft).toBeGreaterThanOrEqual(compRight - iconLeft);
|
|
365
389
|
}));
|
|
366
|
-
(0, fixtures_1.test)("
|
|
367
|
-
yield initTestBed(`<TextBox testId="input" direction="rtl" endIcon="search" />`);
|
|
368
|
-
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(page.getByTestId("input"));
|
|
369
|
-
const { left: iconLeft, right: iconRight } = yield (0, component_test_helpers_1.getBounds)(page.getByRole("img"));
|
|
370
|
-
(0, fixtures_1.expect)(iconRight - compLeft).toBeLessThanOrEqual(compRight - iconLeft);
|
|
371
|
-
}));
|
|
372
|
-
(0, fixtures_1.test)("multiple adornments can be combined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
390
|
+
(0, fixtures_1.test)("multiple adornments can be combined", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
373
391
|
yield initTestBed(`
|
|
374
392
|
<TextBox testId="input" startText="$" endText="USD" startIcon="search" endIcon="search" />`);
|
|
375
|
-
yield (
|
|
376
|
-
yield (0, fixtures_1.expect)(
|
|
377
|
-
yield (0, fixtures_1.expect)(
|
|
378
|
-
yield (0, fixtures_1.expect)(
|
|
393
|
+
const driver = yield createTextBoxDriver("input");
|
|
394
|
+
yield (0, fixtures_1.expect)(driver.startAdornment).toContainText("$");
|
|
395
|
+
yield (0, fixtures_1.expect)(driver.endAdornment).toContainText("USD");
|
|
396
|
+
yield (0, fixtures_1.expect)(driver.startAdornment).toBeVisible();
|
|
397
|
+
yield (0, fixtures_1.expect)(driver.endAdornment).toBeVisible();
|
|
379
398
|
}));
|
|
380
|
-
(0, fixtures_1.test)("all adornments appear in the right place", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
399
|
+
(0, fixtures_1.test)("all adornments appear in the right place", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
381
400
|
yield initTestBed(`
|
|
382
401
|
<TextBox testId="input" startText="$" endText="USD" startIcon="search" endIcon="search" direction="ltr" />
|
|
383
402
|
`);
|
|
384
|
-
const
|
|
385
|
-
const { left:
|
|
386
|
-
const { left:
|
|
387
|
-
const { left:
|
|
388
|
-
const { left:
|
|
403
|
+
const driver = yield createTextBoxDriver("input");
|
|
404
|
+
const { left: compLeft, right: compRight } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
405
|
+
const { left: startTextLeft, right: startTextRight } = yield (0, component_test_helpers_1.getBounds)(driver.startAdornment);
|
|
406
|
+
const { left: endTextLeft, right: endTextRight } = yield (0, component_test_helpers_1.getBounds)(driver.endAdornment);
|
|
407
|
+
const { left: startIconLeft, right: startIconRight } = yield (0, component_test_helpers_1.getBounds)(driver.startAdornment);
|
|
408
|
+
const { left: endIconLeft, right: endIconRight } = yield (0, component_test_helpers_1.getBounds)(driver.endAdornment);
|
|
389
409
|
// Check order of adornments
|
|
390
410
|
(0, fixtures_1.expect)(startTextRight - compLeft).toBeLessThanOrEqual(compRight - startTextLeft);
|
|
391
411
|
(0, fixtures_1.expect)(startIconRight - compLeft).toBeLessThanOrEqual(compRight - startIconLeft);
|
|
@@ -397,30 +417,34 @@ fixtures_1.test.describe("Input Adornments", () => {
|
|
|
397
417
|
// PASSWORD INPUT TESTS
|
|
398
418
|
// =============================================================================
|
|
399
419
|
fixtures_1.test.describe("Password Input", () => {
|
|
400
|
-
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
401
|
-
yield initTestBed(`<PasswordInput />`);
|
|
402
|
-
yield (
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
yield (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
420
|
+
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
421
|
+
yield initTestBed(`<PasswordInput testId="input" />`);
|
|
422
|
+
const driver = yield createTextBoxDriver("input");
|
|
423
|
+
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
424
|
+
}));
|
|
425
|
+
(0, fixtures_1.test)("component has password type", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
426
|
+
yield initTestBed(`<PasswordInput testId="input" />`);
|
|
427
|
+
const driver = yield createTextBoxDriver("input");
|
|
428
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("type", "password");
|
|
429
|
+
}));
|
|
430
|
+
(0, fixtures_1.test)("component has initial value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
431
|
+
yield initTestBed(`<PasswordInput testId="input" initialValue="secret" />`);
|
|
432
|
+
const driver = yield createTextBoxDriver("input");
|
|
433
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("secret");
|
|
434
|
+
}));
|
|
435
|
+
(0, fixtures_1.test)("showPasswordToggle displays visibility toggle", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
413
436
|
yield initTestBed(`<PasswordInput testId="input" showPasswordToggle="true" />`);
|
|
414
|
-
yield (
|
|
437
|
+
const driver = yield createTextBoxDriver("input");
|
|
438
|
+
yield (0, fixtures_1.expect)(driver.input).toBeVisible();
|
|
415
439
|
}));
|
|
416
|
-
(0, fixtures_1.test)("password toggle switches between visible and hidden", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
440
|
+
(0, fixtures_1.test)("password toggle switches between visible and hidden", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
417
441
|
yield initTestBed(`<PasswordInput testId="input" showPasswordToggle="true" />`);
|
|
418
|
-
const
|
|
419
|
-
yield (0, fixtures_1.expect)(
|
|
420
|
-
yield
|
|
421
|
-
yield (0, fixtures_1.expect)(
|
|
442
|
+
const driver = yield createTextBoxDriver("input");
|
|
443
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("type", "password");
|
|
444
|
+
yield driver.button.click();
|
|
445
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveAttribute("type", "text");
|
|
422
446
|
}));
|
|
423
|
-
(0, fixtures_1.test)("custom password icons work correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
447
|
+
(0, fixtures_1.test)("custom password icons work correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
424
448
|
yield initTestBed(`
|
|
425
449
|
<PasswordInput
|
|
426
450
|
testId="input"
|
|
@@ -432,9 +456,10 @@ fixtures_1.test.describe("Password Input", () => {
|
|
|
432
456
|
"icon.test": "resources/bell.svg",
|
|
433
457
|
},
|
|
434
458
|
});
|
|
435
|
-
const
|
|
459
|
+
const driver = yield createTextBoxDriver("input");
|
|
460
|
+
const icon = driver.button;
|
|
436
461
|
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
437
|
-
yield
|
|
462
|
+
yield icon.click();
|
|
438
463
|
yield (0, fixtures_1.expect)(icon).toBeVisible();
|
|
439
464
|
}));
|
|
440
465
|
});
|
|
@@ -442,118 +467,130 @@ fixtures_1.test.describe("Password Input", () => {
|
|
|
442
467
|
// VISUAL STATE TESTS
|
|
443
468
|
// =============================================================================
|
|
444
469
|
fixtures_1.test.describe("Theme Vars", () => {
|
|
445
|
-
(0, fixtures_1.test)("backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
470
|
+
(0, fixtures_1.test)("backgroundColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
446
471
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
447
472
|
testThemeVars: {
|
|
448
473
|
"backgroundColor-TextBox": "rgb(255, 240, 240)",
|
|
449
474
|
},
|
|
450
475
|
});
|
|
451
|
-
yield (
|
|
476
|
+
const driver = yield createTextBoxDriver("input");
|
|
477
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(255, 240, 240)");
|
|
452
478
|
}));
|
|
453
|
-
(0, fixtures_1.test)("borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
479
|
+
(0, fixtures_1.test)("borderColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
454
480
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
455
481
|
testThemeVars: {
|
|
456
482
|
"borderColor-TextBox": "rgb(255, 0, 0)",
|
|
457
483
|
},
|
|
458
484
|
});
|
|
459
|
-
yield (
|
|
485
|
+
const driver = yield createTextBoxDriver("input");
|
|
486
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
460
487
|
}));
|
|
461
|
-
(0, fixtures_1.test)("textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
488
|
+
(0, fixtures_1.test)("textColor applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
462
489
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
463
490
|
testThemeVars: {
|
|
464
491
|
"textColor-TextBox": "rgb(0, 0, 255)",
|
|
465
492
|
},
|
|
466
493
|
});
|
|
467
|
-
yield (
|
|
494
|
+
const driver = yield createTextBoxDriver("input");
|
|
495
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("color", "rgb(0, 0, 255)");
|
|
468
496
|
}));
|
|
469
|
-
(0, fixtures_1.test)("focus borderColor applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
497
|
+
(0, fixtures_1.test)("focus borderColor applies on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
470
498
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
471
499
|
testThemeVars: {
|
|
472
500
|
"borderColor-TextBox--focus": "rgb(0, 255, 0)",
|
|
473
501
|
},
|
|
474
502
|
});
|
|
475
|
-
const
|
|
476
|
-
yield input.focus();
|
|
477
|
-
yield (0, fixtures_1.expect)(
|
|
503
|
+
const driver = yield createTextBoxDriver("input");
|
|
504
|
+
yield driver.input.focus();
|
|
505
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
478
506
|
}));
|
|
479
|
-
(0, fixtures_1.test)("disabled backgroundColor applies when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
507
|
+
(0, fixtures_1.test)("disabled backgroundColor applies when disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
480
508
|
yield initTestBed(`<TextBox testId="input" enabled="false" />`, {
|
|
481
509
|
testThemeVars: {
|
|
482
510
|
"backgroundColor-TextBox--disabled": "rgb(240, 240, 240)",
|
|
483
511
|
},
|
|
484
512
|
});
|
|
485
|
-
yield (
|
|
513
|
+
const driver = yield createTextBoxDriver("input");
|
|
514
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("background-color", "rgb(240, 240, 240)");
|
|
486
515
|
}));
|
|
487
|
-
(0, fixtures_1.test)("error borderColor applies with error validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
516
|
+
(0, fixtures_1.test)("error borderColor applies with error validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
488
517
|
yield initTestBed(`<TextBox testId="input" validationStatus="error" />`, {
|
|
489
518
|
testThemeVars: {
|
|
490
519
|
"borderColor-TextBox-error": "rgb(255, 0, 0)",
|
|
491
520
|
},
|
|
492
521
|
});
|
|
493
|
-
yield (
|
|
522
|
+
const driver = yield createTextBoxDriver("input");
|
|
523
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
494
524
|
}));
|
|
495
|
-
(0, fixtures_1.test)("warning borderColor applies with warning validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
525
|
+
(0, fixtures_1.test)("warning borderColor applies with warning validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
496
526
|
yield initTestBed(`<TextBox testId="input" validationStatus="warning" />`, {
|
|
497
527
|
testThemeVars: {
|
|
498
528
|
"borderColor-TextBox-warning": "rgb(255, 165, 0)",
|
|
499
529
|
},
|
|
500
530
|
});
|
|
501
|
-
yield (
|
|
531
|
+
const driver = yield createTextBoxDriver("input");
|
|
532
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
502
533
|
}));
|
|
503
|
-
(0, fixtures_1.test)("success borderColor applies with valid validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
534
|
+
(0, fixtures_1.test)("success borderColor applies with valid validation", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
504
535
|
yield initTestBed(`<TextBox testId="input" validationStatus="valid" />`, {
|
|
505
536
|
testThemeVars: {
|
|
506
537
|
"borderColor-TextBox-success": "rgb(0, 255, 0)",
|
|
507
538
|
},
|
|
508
539
|
});
|
|
509
|
-
yield (
|
|
540
|
+
const driver = yield createTextBoxDriver("input");
|
|
541
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
510
542
|
}));
|
|
511
|
-
(0, fixtures_1.test)("borderRadius applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
543
|
+
(0, fixtures_1.test)("borderRadius applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
512
544
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
513
545
|
testThemeVars: {
|
|
514
546
|
"borderRadius-TextBox": "8px",
|
|
515
547
|
},
|
|
516
548
|
});
|
|
517
|
-
yield (
|
|
549
|
+
const driver = yield createTextBoxDriver("input");
|
|
550
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-radius", "8px");
|
|
518
551
|
}));
|
|
519
|
-
(0, fixtures_1.test)("padding applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
552
|
+
(0, fixtures_1.test)("padding applies correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
520
553
|
yield initTestBed(`<TextBox testId="input" />`, {
|
|
521
554
|
testThemeVars: {
|
|
522
555
|
"padding-TextBox": "12px",
|
|
523
556
|
},
|
|
524
557
|
});
|
|
525
|
-
yield (
|
|
558
|
+
const driver = yield createTextBoxDriver("input");
|
|
559
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("padding", "12px");
|
|
526
560
|
}));
|
|
527
561
|
});
|
|
528
562
|
// =============================================================================
|
|
529
563
|
// VALIDATION STATUS TESTS
|
|
530
564
|
// =============================================================================
|
|
531
565
|
fixtures_1.test.describe("Validation", () => {
|
|
532
|
-
(0, fixtures_1.test)("validationStatus=error correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
566
|
+
(0, fixtures_1.test)("validationStatus=error correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
533
567
|
yield initTestBed(`<TextBox testId="input" validationStatus="error" />`, {
|
|
534
568
|
testThemeVars: {
|
|
535
569
|
"borderColor-TextBox-error": "rgb(255, 0, 0)",
|
|
536
570
|
},
|
|
537
571
|
});
|
|
538
|
-
yield (
|
|
572
|
+
const driver = yield createTextBoxDriver("input");
|
|
573
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
539
574
|
}));
|
|
540
|
-
(0, fixtures_1.test)("validationStatus=warning correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
575
|
+
(0, fixtures_1.test)("validationStatus=warning correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
541
576
|
yield initTestBed(`<TextBox testId="input" validationStatus="warning" />`, {
|
|
542
577
|
testThemeVars: {
|
|
543
578
|
"borderColor-TextBox-warning": "rgb(255, 165, 0)",
|
|
544
579
|
},
|
|
545
580
|
});
|
|
546
|
-
yield (
|
|
581
|
+
const driver = yield createTextBoxDriver("input");
|
|
582
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
547
583
|
}));
|
|
548
|
-
(0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
584
|
+
(0, fixtures_1.test)("validationStatus=valid correctly displayed", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
549
585
|
yield initTestBed(`<TextBox testId="input" validationStatus="valid" />`, {
|
|
550
586
|
testThemeVars: {
|
|
551
587
|
"borderColor-TextBox-success": "rgb(0, 255, 0)",
|
|
552
588
|
},
|
|
553
589
|
});
|
|
554
|
-
yield (
|
|
590
|
+
const driver = yield createTextBoxDriver("input");
|
|
591
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
555
592
|
}));
|
|
556
|
-
(0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
593
|
+
(0, fixtures_1.test)("handles invalid validationStatus gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
557
594
|
yield initTestBed(`<TextBox testId="input" validationStatus="invalid-status" />`, {
|
|
558
595
|
testThemeVars: {
|
|
559
596
|
"borderColor-TextBox": "rgb(0, 0, 0)",
|
|
@@ -562,82 +599,89 @@ fixtures_1.test.describe("Validation", () => {
|
|
|
562
599
|
"borderColor-TextBox-success": "rgb(0, 255, 0)",
|
|
563
600
|
},
|
|
564
601
|
});
|
|
565
|
-
yield (
|
|
566
|
-
yield (0, fixtures_1.expect)(
|
|
567
|
-
yield (0, fixtures_1.expect)(
|
|
568
|
-
yield (0, fixtures_1.expect)(
|
|
602
|
+
const driver = yield createTextBoxDriver("input");
|
|
603
|
+
yield (0, fixtures_1.expect)(driver.component).not.toHaveCSS("border-color", "rgb(255, 0, 0)");
|
|
604
|
+
yield (0, fixtures_1.expect)(driver.component).not.toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
605
|
+
yield (0, fixtures_1.expect)(driver.component).not.toHaveCSS("border-color", "rgb(0, 255, 0)");
|
|
606
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveCSS("border-color", "rgb(0, 0, 0)");
|
|
569
607
|
}));
|
|
570
608
|
});
|
|
571
609
|
// =============================================================================
|
|
572
610
|
// EDGE CASE TESTS
|
|
573
611
|
// =============================================================================
|
|
574
612
|
fixtures_1.test.describe("Edge Cases", () => {
|
|
575
|
-
(0, fixtures_1.test)("handle special characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
576
|
-
yield initTestBed(`<TextBox />`);
|
|
577
|
-
yield
|
|
578
|
-
yield
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
yield
|
|
583
|
-
yield (
|
|
584
|
-
|
|
585
|
-
|
|
613
|
+
(0, fixtures_1.test)("handle special characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
614
|
+
yield initTestBed(`<TextBox testId="input"/>`);
|
|
615
|
+
const driver = yield createTextBoxDriver("input");
|
|
616
|
+
yield driver.input.fill("Hello 日本語 @#$%!");
|
|
617
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("Hello 日本語 @#$%!");
|
|
618
|
+
}));
|
|
619
|
+
(0, fixtures_1.test)("handle Unicode characters in input", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
620
|
+
yield initTestBed(`<TextBox testId="input"/>`);
|
|
621
|
+
const driver = yield createTextBoxDriver("input");
|
|
622
|
+
yield driver.input.fill("🚀 Unicode test 🎉");
|
|
623
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("🚀 Unicode test 🎉");
|
|
624
|
+
}));
|
|
625
|
+
(0, fixtures_1.test)("component handles very long input text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
586
626
|
const longText = "This is a very long text that might cause layout or performance issues in the component".repeat(10);
|
|
587
|
-
yield initTestBed(`<TextBox />`);
|
|
588
|
-
yield
|
|
589
|
-
yield
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
yield (
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
627
|
+
yield initTestBed(`<TextBox testId="input"/>`);
|
|
628
|
+
const driver = yield createTextBoxDriver("input");
|
|
629
|
+
yield driver.input.fill(longText);
|
|
630
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue(longText);
|
|
631
|
+
}));
|
|
632
|
+
(0, fixtures_1.test)("component handles special characters correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
633
|
+
yield initTestBed(`<TextBox testId="input" label="Input with !@#$%^&*()"/>`, {});
|
|
634
|
+
const driver = yield createTextBoxDriver("input");
|
|
635
|
+
yield (0, fixtures_1.expect)(driver.label).toBeVisible();
|
|
636
|
+
}));
|
|
637
|
+
(0, fixtures_1.test)("component handles extremely long input values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
638
|
+
yield initTestBed(`<TextBox testId="input"/>`);
|
|
639
|
+
const driver = yield createTextBoxDriver("input");
|
|
597
640
|
const veryLongText = "A".repeat(10000);
|
|
598
|
-
yield
|
|
599
|
-
yield (0, fixtures_1.expect)(
|
|
641
|
+
yield driver.input.fill(veryLongText);
|
|
642
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue(veryLongText);
|
|
600
643
|
}));
|
|
601
644
|
});
|
|
602
645
|
// =============================================================================
|
|
603
646
|
// INTEGRATION TESTS
|
|
604
647
|
// =============================================================================
|
|
605
648
|
fixtures_1.test.describe("Integration", () => {
|
|
606
|
-
(0, fixtures_1.test)("component works correctly in Stack layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
649
|
+
(0, fixtures_1.test)("component works correctly in Stack layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
607
650
|
yield initTestBed(`<Stack><TextBox testId="input" /></Stack>`);
|
|
608
|
-
const
|
|
609
|
-
const { width, height } = yield (0, component_test_helpers_1.getBounds)(input);
|
|
610
|
-
yield (0, fixtures_1.expect)(input).toBeVisible();
|
|
651
|
+
const driver = yield createTextBoxDriver("input");
|
|
652
|
+
const { width, height } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
653
|
+
yield (0, fixtures_1.expect)(driver.input).toBeVisible();
|
|
611
654
|
(0, fixtures_1.expect)(width).toBeGreaterThan(0);
|
|
612
655
|
(0, fixtures_1.expect)(height).toBeGreaterThan(0);
|
|
613
656
|
}));
|
|
614
|
-
(0, fixtures_1.test)("component works correctly in FlowLayout layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
657
|
+
(0, fixtures_1.test)("component works correctly in FlowLayout layout contexts", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
615
658
|
yield initTestBed(`<FlowLayout><TextBox testId="input" /></FlowLayout>`);
|
|
616
|
-
const
|
|
617
|
-
const { width, height } = yield (0, component_test_helpers_1.getBounds)(input);
|
|
618
|
-
yield (0, fixtures_1.expect)(input).toBeVisible();
|
|
659
|
+
const driver = yield createTextBoxDriver("input");
|
|
660
|
+
const { width, height } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
661
|
+
yield (0, fixtures_1.expect)(driver.input).toBeVisible();
|
|
619
662
|
(0, fixtures_1.expect)(width).toBeGreaterThan(0);
|
|
620
663
|
(0, fixtures_1.expect)(height).toBeGreaterThan(0);
|
|
621
664
|
}));
|
|
622
|
-
(0, fixtures_1.test)("component integrates with forms correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed,
|
|
623
|
-
yield initTestBed(`<Form><TextBox label="Username" /></Form>`);
|
|
624
|
-
const
|
|
625
|
-
const { width, height } = yield (0, component_test_helpers_1.getBounds)(input);
|
|
626
|
-
yield (0, fixtures_1.expect)(input).toBeVisible();
|
|
665
|
+
(0, fixtures_1.test)("component integrates with forms correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
666
|
+
yield initTestBed(`<Form><TextBox testId="input" label="Username" /></Form>`);
|
|
667
|
+
const driver = yield createTextBoxDriver("input");
|
|
668
|
+
const { width, height } = yield (0, component_test_helpers_1.getBounds)(driver.input);
|
|
669
|
+
yield (0, fixtures_1.expect)(driver.input).toBeVisible();
|
|
627
670
|
(0, fixtures_1.expect)(width).toBeGreaterThan(0);
|
|
628
671
|
(0, fixtures_1.expect)(height).toBeGreaterThan(0);
|
|
629
672
|
}));
|
|
630
|
-
(0, fixtures_1.test)("component works with conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
673
|
+
(0, fixtures_1.test)("component works with conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTextBoxDriver }) {
|
|
631
674
|
yield initTestBed(`
|
|
632
675
|
<Fragment var.showInput="{true}">
|
|
633
676
|
<Fragment when="{showInput}">
|
|
634
|
-
<TextBox label="Conditional input" />
|
|
677
|
+
<TextBox testId="input" label="Conditional input" />
|
|
635
678
|
</Fragment>
|
|
636
679
|
<Button testId="toggleBtn" onClick="showInput = !showInput">Toggle</Button>
|
|
637
680
|
</Fragment>
|
|
638
681
|
`);
|
|
639
|
-
yield (
|
|
682
|
+
const driver = yield createTextBoxDriver("input");
|
|
683
|
+
yield (0, fixtures_1.expect)(driver.label).toBeVisible();
|
|
640
684
|
yield page.getByTestId("toggleBtn").click();
|
|
641
|
-
yield (0, fixtures_1.expect)(
|
|
685
|
+
yield (0, fixtures_1.expect)(driver.label).not.toBeVisible();
|
|
642
686
|
}));
|
|
643
687
|
});
|