@ebertjendustries/cstestwrapper 1.0.17 → 1.0.19
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 +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +24 -4
- package/dist/index.mjs +24 -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> {
|
|
@@ -194,6 +195,7 @@ declare class HeaderTesting extends AbstractComponentTesting<HeaderWrapper, Fiel
|
|
|
194
195
|
expectCounter(counterText: string | RegExp): void;
|
|
195
196
|
expectContent(content: string | RegExp): void;
|
|
196
197
|
expectNotContent(content: string | RegExp): void;
|
|
198
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
declare class BoxTesting extends AbstractComponentTesting<BoxWrapper, FieldSpec> {
|
|
@@ -291,6 +293,7 @@ declare class TextareaTesting extends AbstractInputTesting<TextareaWrapper, HTML
|
|
|
291
293
|
setStringValue(value: string): void;
|
|
292
294
|
expectValue(value: number | string | undefined): void;
|
|
293
295
|
protected getNativeHTMLInput(): HTMLTextAreaElement;
|
|
296
|
+
expectFormLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
declare class TabsTesting extends AbstractComponentTesting<TabsWrapper, FieldSpec> {
|
|
@@ -310,6 +313,7 @@ declare class TextContentTesting extends AbstractComponentTesting<TextContentWra
|
|
|
310
313
|
protected view: AbstractViewTesting<any>;
|
|
311
314
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
312
315
|
expectContent(content: string | RegExp): void;
|
|
316
|
+
expectHTMLContent(content: string): void;
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
declare class PaginationTesting extends AbstractComponentTesting<PaginationWrapper, FieldSpec> {
|
|
@@ -341,6 +345,7 @@ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClip
|
|
|
341
345
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
342
346
|
expectEnabled(): void;
|
|
343
347
|
copyText(text: string | RegExp): Promise<void>;
|
|
348
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
344
349
|
}
|
|
345
350
|
|
|
346
351
|
/**
|
|
@@ -420,6 +425,8 @@ declare abstract class AbstractComponentTesting<WrapperType extends ElementWrapp
|
|
|
420
425
|
static expectEnabled(element: HTMLElement, msg: string): void;
|
|
421
426
|
static expectDisabled(element: HTMLElement, msg: string): void;
|
|
422
427
|
protected static doFindElement<WrapperType extends ElementWrapper$1 | ComponentWrapper>(dataTestId: string, findFunction: (selector: string) => WrapperType | null): WrapperType | null;
|
|
428
|
+
protected getLocalisedField(variables?: any, alternateNs?: LocalisationNamespace): _ebertjendustries_cswrapper.LocalisedElements;
|
|
429
|
+
expectFormFieldLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
423
430
|
expectFormFieldLabelDisplayed(): void;
|
|
424
431
|
expectFormFieldLabelNotDisplayed(): void;
|
|
425
432
|
getElement(): HTMLElement;
|
|
@@ -515,7 +522,7 @@ declare class MockBrowserAPIs {
|
|
|
515
522
|
}
|
|
516
523
|
|
|
517
524
|
declare function setupRestClientMock(controllerSpec: ViewSpec<any>): MockRestClient;
|
|
518
|
-
declare class MockRestClient implements
|
|
525
|
+
declare class MockRestClient implements _ebertjendustries_cswrapper.IRestClient {
|
|
519
526
|
get: vitest.Mock<(...args: any[]) => any>;
|
|
520
527
|
put: vitest.Mock<(...args: any[]) => any>;
|
|
521
528
|
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> {
|
|
@@ -194,6 +195,7 @@ declare class HeaderTesting extends AbstractComponentTesting<HeaderWrapper, Fiel
|
|
|
194
195
|
expectCounter(counterText: string | RegExp): void;
|
|
195
196
|
expectContent(content: string | RegExp): void;
|
|
196
197
|
expectNotContent(content: string | RegExp): void;
|
|
198
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
declare class BoxTesting extends AbstractComponentTesting<BoxWrapper, FieldSpec> {
|
|
@@ -291,6 +293,7 @@ declare class TextareaTesting extends AbstractInputTesting<TextareaWrapper, HTML
|
|
|
291
293
|
setStringValue(value: string): void;
|
|
292
294
|
expectValue(value: number | string | undefined): void;
|
|
293
295
|
protected getNativeHTMLInput(): HTMLTextAreaElement;
|
|
296
|
+
expectFormLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
declare class TabsTesting extends AbstractComponentTesting<TabsWrapper, FieldSpec> {
|
|
@@ -310,6 +313,7 @@ declare class TextContentTesting extends AbstractComponentTesting<TextContentWra
|
|
|
310
313
|
protected view: AbstractViewTesting<any>;
|
|
311
314
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
312
315
|
expectContent(content: string | RegExp): void;
|
|
316
|
+
expectHTMLContent(content: string): void;
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
declare class PaginationTesting extends AbstractComponentTesting<PaginationWrapper, FieldSpec> {
|
|
@@ -341,6 +345,7 @@ declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClip
|
|
|
341
345
|
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
342
346
|
expectEnabled(): void;
|
|
343
347
|
copyText(text: string | RegExp): Promise<void>;
|
|
348
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
344
349
|
}
|
|
345
350
|
|
|
346
351
|
/**
|
|
@@ -420,6 +425,8 @@ declare abstract class AbstractComponentTesting<WrapperType extends ElementWrapp
|
|
|
420
425
|
static expectEnabled(element: HTMLElement, msg: string): void;
|
|
421
426
|
static expectDisabled(element: HTMLElement, msg: string): void;
|
|
422
427
|
protected static doFindElement<WrapperType extends ElementWrapper$1 | ComponentWrapper>(dataTestId: string, findFunction: (selector: string) => WrapperType | null): WrapperType | null;
|
|
428
|
+
protected getLocalisedField(variables?: any, alternateNs?: LocalisationNamespace): _ebertjendustries_cswrapper.LocalisedElements;
|
|
429
|
+
expectFormFieldLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
423
430
|
expectFormFieldLabelDisplayed(): void;
|
|
424
431
|
expectFormFieldLabelNotDisplayed(): void;
|
|
425
432
|
getElement(): HTMLElement;
|
|
@@ -515,7 +522,7 @@ declare class MockBrowserAPIs {
|
|
|
515
522
|
}
|
|
516
523
|
|
|
517
524
|
declare function setupRestClientMock(controllerSpec: ViewSpec<any>): MockRestClient;
|
|
518
|
-
declare class MockRestClient implements
|
|
525
|
+
declare class MockRestClient implements _ebertjendustries_cswrapper.IRestClient {
|
|
519
526
|
get: vitest.Mock<(...args: any[]) => any>;
|
|
520
527
|
put: vitest.Mock<(...args: any[]) => any>;
|
|
521
528
|
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
|
|
@@ -827,6 +836,9 @@ var HeaderTesting = class extends AbstractComponentTesting {
|
|
|
827
836
|
expectNotContent(content) {
|
|
828
837
|
(0, import_vitest11.expect)(this.getElementWrapper().findHeadingText().getElement()).not.toHaveTextContent(content);
|
|
829
838
|
}
|
|
839
|
+
expectLocalisation(variables, alternateNs) {
|
|
840
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
841
|
+
}
|
|
830
842
|
};
|
|
831
843
|
|
|
832
844
|
// src/components/BoxTesting.ts
|
|
@@ -841,8 +853,7 @@ var BoxTesting = class extends AbstractComponentTesting {
|
|
|
841
853
|
(0, import_vitest12.expect)(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
842
854
|
}
|
|
843
855
|
expectLocalisation(variables, alternateNs) {
|
|
844
|
-
|
|
845
|
-
this.expectContent(localisedElements.children.trim());
|
|
856
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
846
857
|
}
|
|
847
858
|
};
|
|
848
859
|
|
|
@@ -1062,8 +1073,7 @@ var AlertTesting = class extends AbstractComponentTesting {
|
|
|
1062
1073
|
(0, import_vitest16.expect)(this.getElementWrapper().findContent().getElement()).toHaveTextContent(content);
|
|
1063
1074
|
}
|
|
1064
1075
|
expectLocalisation(variables, alternateNs) {
|
|
1065
|
-
|
|
1066
|
-
this.expectContent(localisedElements.children);
|
|
1076
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
1067
1077
|
}
|
|
1068
1078
|
};
|
|
1069
1079
|
|
|
@@ -1161,6 +1171,10 @@ var TextareaTesting = class extends AbstractInputTesting {
|
|
|
1161
1171
|
getNativeHTMLInput() {
|
|
1162
1172
|
return this.getElementWrapper().findNativeTextarea().getElement();
|
|
1163
1173
|
}
|
|
1174
|
+
expectFormLocalisation(variables, alternateNs) {
|
|
1175
|
+
this.expectFormFieldLocalisation(variables, alternateNs);
|
|
1176
|
+
(0, import_vitest19.expect)(this.getNativeHTMLInput().placeholder).toEqual(this.getLocalisedField(variables, alternateNs).placeholder);
|
|
1177
|
+
}
|
|
1164
1178
|
};
|
|
1165
1179
|
|
|
1166
1180
|
// src/components/TabsTesting.ts
|
|
@@ -1213,6 +1227,9 @@ var TextContentTesting = class extends AbstractComponentTesting {
|
|
|
1213
1227
|
expectContent(content) {
|
|
1214
1228
|
(0, import_vitest21.expect)(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
1215
1229
|
}
|
|
1230
|
+
expectHTMLContent(content) {
|
|
1231
|
+
(0, import_vitest21.expect)(this.getElementWrapper().getElement().outerHTML.includes(content)).toBeTruthy();
|
|
1232
|
+
}
|
|
1216
1233
|
};
|
|
1217
1234
|
|
|
1218
1235
|
// src/components/PaginationTesting.ts
|
|
@@ -1309,6 +1326,9 @@ var CopyToClipboardTesting = class extends AbstractComponentTesting {
|
|
|
1309
1326
|
});
|
|
1310
1327
|
}
|
|
1311
1328
|
}
|
|
1329
|
+
expectLocalisation(variables, alternateNs) {
|
|
1330
|
+
(0, import_vitest24.expect)(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).copyButtonText);
|
|
1331
|
+
}
|
|
1312
1332
|
};
|
|
1313
1333
|
|
|
1314
1334
|
// 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
|
|
@@ -745,6 +754,9 @@ var HeaderTesting = class extends AbstractComponentTesting {
|
|
|
745
754
|
expectNotContent(content) {
|
|
746
755
|
expect11(this.getElementWrapper().findHeadingText().getElement()).not.toHaveTextContent(content);
|
|
747
756
|
}
|
|
757
|
+
expectLocalisation(variables, alternateNs) {
|
|
758
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
759
|
+
}
|
|
748
760
|
};
|
|
749
761
|
|
|
750
762
|
// src/components/BoxTesting.ts
|
|
@@ -759,8 +771,7 @@ var BoxTesting = class extends AbstractComponentTesting {
|
|
|
759
771
|
expect12(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
760
772
|
}
|
|
761
773
|
expectLocalisation(variables, alternateNs) {
|
|
762
|
-
|
|
763
|
-
this.expectContent(localisedElements.children.trim());
|
|
774
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children.trim());
|
|
764
775
|
}
|
|
765
776
|
};
|
|
766
777
|
|
|
@@ -980,8 +991,7 @@ var AlertTesting = class extends AbstractComponentTesting {
|
|
|
980
991
|
expect16(this.getElementWrapper().findContent().getElement()).toHaveTextContent(content);
|
|
981
992
|
}
|
|
982
993
|
expectLocalisation(variables, alternateNs) {
|
|
983
|
-
|
|
984
|
-
this.expectContent(localisedElements.children);
|
|
994
|
+
this.expectContent(this.getLocalisedField(variables, alternateNs).children);
|
|
985
995
|
}
|
|
986
996
|
};
|
|
987
997
|
|
|
@@ -1079,6 +1089,10 @@ var TextareaTesting = class extends AbstractInputTesting {
|
|
|
1079
1089
|
getNativeHTMLInput() {
|
|
1080
1090
|
return this.getElementWrapper().findNativeTextarea().getElement();
|
|
1081
1091
|
}
|
|
1092
|
+
expectFormLocalisation(variables, alternateNs) {
|
|
1093
|
+
this.expectFormFieldLocalisation(variables, alternateNs);
|
|
1094
|
+
expect19(this.getNativeHTMLInput().placeholder).toEqual(this.getLocalisedField(variables, alternateNs).placeholder);
|
|
1095
|
+
}
|
|
1082
1096
|
};
|
|
1083
1097
|
|
|
1084
1098
|
// src/components/TabsTesting.ts
|
|
@@ -1131,6 +1145,9 @@ var TextContentTesting = class extends AbstractComponentTesting {
|
|
|
1131
1145
|
expectContent(content) {
|
|
1132
1146
|
expect21(this.getElementWrapper().getElement()).toHaveTextContent(content);
|
|
1133
1147
|
}
|
|
1148
|
+
expectHTMLContent(content) {
|
|
1149
|
+
expect21(this.getElementWrapper().getElement().outerHTML.includes(content)).toBeTruthy();
|
|
1150
|
+
}
|
|
1134
1151
|
};
|
|
1135
1152
|
|
|
1136
1153
|
// src/components/PaginationTesting.ts
|
|
@@ -1227,6 +1244,9 @@ var CopyToClipboardTesting = class extends AbstractComponentTesting {
|
|
|
1227
1244
|
});
|
|
1228
1245
|
}
|
|
1229
1246
|
}
|
|
1247
|
+
expectLocalisation(variables, alternateNs) {
|
|
1248
|
+
expect24(this.getElementWrapper().findCopyButton().getElement(), this.msgForExpect()).toHaveTextContent(this.getLocalisedField(variables, alternateNs).copyButtonText);
|
|
1249
|
+
}
|
|
1230
1250
|
};
|
|
1231
1251
|
|
|
1232
1252
|
// src/components/TestingFactory.ts
|