@ebertjendustries/cstestwrapper 1.0.17 → 1.0.18
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/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +21 -4
- package/dist/index.mjs +21 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _ebertjendustries_cswrapper from '@ebertjendustries/cswrapper';
|
|
2
2
|
import { LocalisationNamespace, Localiser, FieldSpec, EnumFactory, ViewSpec, IViewElementSpec, LocalisationVariableType, CSVNoItemsViewElements, CSVPriceInputViewElements, IPrice, CSVSearchFilterViewElements, CSVTextPromptModalViewElements, PropertyChangeFunction } from '@ebertjendustries/cswrapper';
|
|
3
3
|
import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, CopyToClipboardWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper } from '@cloudscape-design/components/test-utils/dom';
|
|
4
4
|
import { ElementWrapper, ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
|
|
@@ -143,6 +143,7 @@ declare class ButtonTesting extends AbstractComponentTesting<ButtonWrapper, Fiel
|
|
|
143
143
|
awaitLoading(): Promise<void>;
|
|
144
144
|
awaitNotLoading(): Promise<void>;
|
|
145
145
|
clickAndWaitForLoadingDone(): Promise<void>;
|
|
146
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
declare class ButtonDropdownTesting extends AbstractComponentTesting<ButtonDropdownWrapper, FieldSpec> {
|
|
@@ -291,6 +292,7 @@ declare class TextareaTesting extends AbstractInputTesting<TextareaWrapper, HTML
|
|
|
291
292
|
setStringValue(value: string): void;
|
|
292
293
|
expectValue(value: number | string | undefined): void;
|
|
293
294
|
protected getNativeHTMLInput(): HTMLTextAreaElement;
|
|
295
|
+
expectFormLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
declare class TabsTesting extends AbstractComponentTesting<TabsWrapper, FieldSpec> {
|
|
@@ -310,6 +312,7 @@ declare class TextContentTesting extends AbstractComponentTesting<TextContentWra
|
|
|
310
312
|
protected view: AbstractViewTesting<any>;
|
|
311
313
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
312
314
|
expectContent(content: string | RegExp): void;
|
|
315
|
+
expectHTMLContent(content: string): void;
|
|
313
316
|
}
|
|
314
317
|
|
|
315
318
|
declare class PaginationTesting extends AbstractComponentTesting<PaginationWrapper, FieldSpec> {
|
|
@@ -341,6 +344,7 @@ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClip
|
|
|
341
344
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
342
345
|
expectEnabled(): void;
|
|
343
346
|
copyText(text: string | RegExp): Promise<void>;
|
|
347
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
344
348
|
}
|
|
345
349
|
|
|
346
350
|
/**
|
|
@@ -420,6 +424,8 @@ declare abstract class AbstractComponentTesting<WrapperType extends ElementWrapp
|
|
|
420
424
|
static expectEnabled(element: HTMLElement, msg: string): void;
|
|
421
425
|
static expectDisabled(element: HTMLElement, msg: string): void;
|
|
422
426
|
protected static doFindElement<WrapperType extends ElementWrapper$1 | ComponentWrapper>(dataTestId: string, findFunction: (selector: string) => WrapperType | null): WrapperType | null;
|
|
427
|
+
protected getLocalisedField(variables?: any, alternateNs?: LocalisationNamespace): _ebertjendustries_cswrapper.LocalisedElements;
|
|
428
|
+
expectFormFieldLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
423
429
|
expectFormFieldLabelDisplayed(): void;
|
|
424
430
|
expectFormFieldLabelNotDisplayed(): void;
|
|
425
431
|
getElement(): HTMLElement;
|
|
@@ -515,7 +521,7 @@ declare class MockBrowserAPIs {
|
|
|
515
521
|
}
|
|
516
522
|
|
|
517
523
|
declare function setupRestClientMock(controllerSpec: ViewSpec<any>): MockRestClient;
|
|
518
|
-
declare class MockRestClient implements
|
|
524
|
+
declare class MockRestClient implements _ebertjendustries_cswrapper.IRestClient {
|
|
519
525
|
get: vitest.Mock<(...args: any[]) => any>;
|
|
520
526
|
put: vitest.Mock<(...args: any[]) => any>;
|
|
521
527
|
post: vitest.Mock<(...args: any[]) => any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _ebertjendustries_cswrapper from '@ebertjendustries/cswrapper';
|
|
2
2
|
import { LocalisationNamespace, Localiser, FieldSpec, EnumFactory, ViewSpec, IViewElementSpec, LocalisationVariableType, CSVNoItemsViewElements, CSVPriceInputViewElements, IPrice, CSVSearchFilterViewElements, CSVTextPromptModalViewElements, PropertyChangeFunction } from '@ebertjendustries/cswrapper';
|
|
3
3
|
import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, CopyToClipboardWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper } from '@cloudscape-design/components/test-utils/dom';
|
|
4
4
|
import { ElementWrapper, ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
|
|
@@ -143,6 +143,7 @@ declare class ButtonTesting extends AbstractComponentTesting<ButtonWrapper, Fiel
|
|
|
143
143
|
awaitLoading(): Promise<void>;
|
|
144
144
|
awaitNotLoading(): Promise<void>;
|
|
145
145
|
clickAndWaitForLoadingDone(): Promise<void>;
|
|
146
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
declare class ButtonDropdownTesting extends AbstractComponentTesting<ButtonDropdownWrapper, FieldSpec> {
|
|
@@ -291,6 +292,7 @@ declare class TextareaTesting extends AbstractInputTesting<TextareaWrapper, HTML
|
|
|
291
292
|
setStringValue(value: string): void;
|
|
292
293
|
expectValue(value: number | string | undefined): void;
|
|
293
294
|
protected getNativeHTMLInput(): HTMLTextAreaElement;
|
|
295
|
+
expectFormLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
declare class TabsTesting extends AbstractComponentTesting<TabsWrapper, FieldSpec> {
|
|
@@ -310,6 +312,7 @@ declare class TextContentTesting extends AbstractComponentTesting<TextContentWra
|
|
|
310
312
|
protected view: AbstractViewTesting<any>;
|
|
311
313
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
312
314
|
expectContent(content: string | RegExp): void;
|
|
315
|
+
expectHTMLContent(content: string): void;
|
|
313
316
|
}
|
|
314
317
|
|
|
315
318
|
declare class PaginationTesting extends AbstractComponentTesting<PaginationWrapper, FieldSpec> {
|
|
@@ -341,6 +344,7 @@ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClip
|
|
|
341
344
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
342
345
|
expectEnabled(): void;
|
|
343
346
|
copyText(text: string | RegExp): Promise<void>;
|
|
347
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
344
348
|
}
|
|
345
349
|
|
|
346
350
|
/**
|
|
@@ -420,6 +424,8 @@ declare abstract class AbstractComponentTesting<WrapperType extends ElementWrapp
|
|
|
420
424
|
static expectEnabled(element: HTMLElement, msg: string): void;
|
|
421
425
|
static expectDisabled(element: HTMLElement, msg: string): void;
|
|
422
426
|
protected static doFindElement<WrapperType extends ElementWrapper$1 | ComponentWrapper>(dataTestId: string, findFunction: (selector: string) => WrapperType | null): WrapperType | null;
|
|
427
|
+
protected getLocalisedField(variables?: any, alternateNs?: LocalisationNamespace): _ebertjendustries_cswrapper.LocalisedElements;
|
|
428
|
+
expectFormFieldLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
423
429
|
expectFormFieldLabelDisplayed(): void;
|
|
424
430
|
expectFormFieldLabelNotDisplayed(): void;
|
|
425
431
|
getElement(): HTMLElement;
|
|
@@ -515,7 +521,7 @@ declare class MockBrowserAPIs {
|
|
|
515
521
|
}
|
|
516
522
|
|
|
517
523
|
declare function setupRestClientMock(controllerSpec: ViewSpec<any>): MockRestClient;
|
|
518
|
-
declare class MockRestClient implements
|
|
524
|
+
declare class MockRestClient implements _ebertjendustries_cswrapper.IRestClient {
|
|
519
525
|
get: vitest.Mock<(...args: any[]) => any>;
|
|
520
526
|
put: vitest.Mock<(...args: any[]) => any>;
|
|
521
527
|
post: vitest.Mock<(...args: any[]) => any>;
|
package/dist/index.js
CHANGED
|
@@ -116,6 +116,12 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
|
|
|
116
116
|
static doFindElement(dataTestId, findFunction) {
|
|
117
117
|
return findFunction(`[data-testid*=${dataTestId}]`);
|
|
118
118
|
}
|
|
119
|
+
getLocalisedField(variables, alternateNs) {
|
|
120
|
+
return this.view.getLocaliser().localiseField(this.elementSpec.getLocalisationKey(), variables, alternateNs);
|
|
121
|
+
}
|
|
122
|
+
expectFormFieldLocalisation(variables, alternateNs) {
|
|
123
|
+
(0, import_vitest.expect)(this.getFormFieldWrapper().findLabel().getElement()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).formField.label);
|
|
124
|
+
}
|
|
119
125
|
expectFormFieldLabelDisplayed() {
|
|
120
126
|
(0, import_vitest.expect)(this.getFormFieldWrapper().findLabel()).not.toBeNull();
|
|
121
127
|
}
|
|
@@ -662,6 +668,9 @@ var ButtonTesting = class extends AbstractComponentTesting {
|
|
|
662
668
|
await this.awaitLoading();
|
|
663
669
|
await this.awaitNotLoading();
|
|
664
670
|
}
|
|
671
|
+
expectLocalisation(variables, alternateNs) {
|
|
672
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
673
|
+
}
|
|
665
674
|
};
|
|
666
675
|
|
|
667
676
|
// src/components/ButtonDropdownTesting.ts
|
|
@@ -841,8 +850,7 @@ var BoxTesting = class extends AbstractComponentTesting {
|
|
|
841
850
|
(0, import_vitest12.expect)(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
842
851
|
}
|
|
843
852
|
expectLocalisation(variables, alternateNs) {
|
|
844
|
-
|
|
845
|
-
this.expectContent(localisedElements.children.trim());
|
|
853
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
846
854
|
}
|
|
847
855
|
};
|
|
848
856
|
|
|
@@ -1062,8 +1070,7 @@ var AlertTesting = class extends AbstractComponentTesting {
|
|
|
1062
1070
|
(0, import_vitest16.expect)(this.getElementWrapper().findContent().getElement()).toHaveTextContent(content);
|
|
1063
1071
|
}
|
|
1064
1072
|
expectLocalisation(variables, alternateNs) {
|
|
1065
|
-
|
|
1066
|
-
this.expectContent(localisedElements.children);
|
|
1073
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
1067
1074
|
}
|
|
1068
1075
|
};
|
|
1069
1076
|
|
|
@@ -1161,6 +1168,10 @@ var TextareaTesting = class extends AbstractInputTesting {
|
|
|
1161
1168
|
getNativeHTMLInput() {
|
|
1162
1169
|
return this.getElementWrapper().findNativeTextarea().getElement();
|
|
1163
1170
|
}
|
|
1171
|
+
expectFormLocalisation(variables, alternateNs) {
|
|
1172
|
+
this.expectFormFieldLocalisation(variables, alternateNs);
|
|
1173
|
+
(0, import_vitest19.expect)(this.getNativeHTMLInput().placeholder).toEqual(this.getLocalisedField(variables, alternateNs).placeholder);
|
|
1174
|
+
}
|
|
1164
1175
|
};
|
|
1165
1176
|
|
|
1166
1177
|
// src/components/TabsTesting.ts
|
|
@@ -1213,6 +1224,9 @@ var TextContentTesting = class extends AbstractComponentTesting {
|
|
|
1213
1224
|
expectContent(content) {
|
|
1214
1225
|
(0, import_vitest21.expect)(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
1215
1226
|
}
|
|
1227
|
+
expectHTMLContent(content) {
|
|
1228
|
+
(0, import_vitest21.expect)(this.getElementWrapper().getElement().outerHTML.includes(content)).toBeTruthy();
|
|
1229
|
+
}
|
|
1216
1230
|
};
|
|
1217
1231
|
|
|
1218
1232
|
// src/components/PaginationTesting.ts
|
|
@@ -1309,6 +1323,9 @@ var CopyToClipboardTesting = class extends AbstractComponentTesting {
|
|
|
1309
1323
|
});
|
|
1310
1324
|
}
|
|
1311
1325
|
}
|
|
1326
|
+
expectLocalisation(variables, alternateNs) {
|
|
1327
|
+
(0, import_vitest24.expect)(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).copyButtonText);
|
|
1328
|
+
}
|
|
1312
1329
|
};
|
|
1313
1330
|
|
|
1314
1331
|
// src/components/TestingFactory.ts
|
package/dist/index.mjs
CHANGED
|
@@ -34,6 +34,12 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
|
|
|
34
34
|
static doFindElement(dataTestId, findFunction) {
|
|
35
35
|
return findFunction(`[data-testid*=${dataTestId}]`);
|
|
36
36
|
}
|
|
37
|
+
getLocalisedField(variables, alternateNs) {
|
|
38
|
+
return this.view.getLocaliser().localiseField(this.elementSpec.getLocalisationKey(), variables, alternateNs);
|
|
39
|
+
}
|
|
40
|
+
expectFormFieldLocalisation(variables, alternateNs) {
|
|
41
|
+
expect(this.getFormFieldWrapper().findLabel().getElement()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).formField.label);
|
|
42
|
+
}
|
|
37
43
|
expectFormFieldLabelDisplayed() {
|
|
38
44
|
expect(this.getFormFieldWrapper().findLabel()).not.toBeNull();
|
|
39
45
|
}
|
|
@@ -580,6 +586,9 @@ var ButtonTesting = class extends AbstractComponentTesting {
|
|
|
580
586
|
await this.awaitLoading();
|
|
581
587
|
await this.awaitNotLoading();
|
|
582
588
|
}
|
|
589
|
+
expectLocalisation(variables, alternateNs) {
|
|
590
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
591
|
+
}
|
|
583
592
|
};
|
|
584
593
|
|
|
585
594
|
// src/components/ButtonDropdownTesting.ts
|
|
@@ -759,8 +768,7 @@ var BoxTesting = class extends AbstractComponentTesting {
|
|
|
759
768
|
expect12(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
760
769
|
}
|
|
761
770
|
expectLocalisation(variables, alternateNs) {
|
|
762
|
-
|
|
763
|
-
this.expectContent(localisedElements.children.trim());
|
|
771
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
764
772
|
}
|
|
765
773
|
};
|
|
766
774
|
|
|
@@ -980,8 +988,7 @@ var AlertTesting = class extends AbstractComponentTesting {
|
|
|
980
988
|
expect16(this.getElementWrapper().findContent().getElement()).toHaveTextContent(content);
|
|
981
989
|
}
|
|
982
990
|
expectLocalisation(variables, alternateNs) {
|
|
983
|
-
|
|
984
|
-
this.expectContent(localisedElements.children);
|
|
991
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
985
992
|
}
|
|
986
993
|
};
|
|
987
994
|
|
|
@@ -1079,6 +1086,10 @@ var TextareaTesting = class extends AbstractInputTesting {
|
|
|
1079
1086
|
getNativeHTMLInput() {
|
|
1080
1087
|
return this.getElementWrapper().findNativeTextarea().getElement();
|
|
1081
1088
|
}
|
|
1089
|
+
expectFormLocalisation(variables, alternateNs) {
|
|
1090
|
+
this.expectFormFieldLocalisation(variables, alternateNs);
|
|
1091
|
+
expect19(this.getNativeHTMLInput().placeholder).toEqual(this.getLocalisedField(variables, alternateNs).placeholder);
|
|
1092
|
+
}
|
|
1082
1093
|
};
|
|
1083
1094
|
|
|
1084
1095
|
// src/components/TabsTesting.ts
|
|
@@ -1131,6 +1142,9 @@ var TextContentTesting = class extends AbstractComponentTesting {
|
|
|
1131
1142
|
expectContent(content) {
|
|
1132
1143
|
expect21(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
1133
1144
|
}
|
|
1145
|
+
expectHTMLContent(content) {
|
|
1146
|
+
expect21(this.getElementWrapper().getElement().outerHTML.includes(content)).toBeTruthy();
|
|
1147
|
+
}
|
|
1134
1148
|
};
|
|
1135
1149
|
|
|
1136
1150
|
// src/components/PaginationTesting.ts
|
|
@@ -1227,6 +1241,9 @@ var CopyToClipboardTesting = class extends AbstractComponentTesting {
|
|
|
1227
1241
|
});
|
|
1228
1242
|
}
|
|
1229
1243
|
}
|
|
1244
|
+
expectLocalisation(variables, alternateNs) {
|
|
1245
|
+
expect24(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).copyButtonText);
|
|
1246
|
+
}
|
|
1230
1247
|
};
|
|
1231
1248
|
|
|
1232
1249
|
// src/components/TestingFactory.ts
|