@skyux/forms 12.0.0-alpha.0 → 12.0.0-alpha.10
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/documentation.json +11318 -7163
- package/fesm2022/skyux-forms-testing.mjs +266 -31
- package/fesm2022/skyux-forms-testing.mjs.map +1 -1
- package/fesm2022/skyux-forms.mjs +471 -237
- package/fesm2022/skyux-forms.mjs.map +1 -1
- package/lib/modules/checkbox/checkbox-group.component.d.ts +1 -1
- package/lib/modules/checkbox/checkbox.component.d.ts +11 -4
- package/lib/modules/file-attachment/file-attachment/file-attachment.service.d.ts +1 -1
- package/lib/modules/file-attachment/file-drop/file-drop.component.d.ts +10 -2
- package/lib/modules/form-error/form-error.component.d.ts +1 -0
- package/lib/modules/radio/radio.component.d.ts +8 -1
- package/package.json +14 -14
- package/testing/modules/character-counter/character-counter-indicator-harness-filters.d.ts +0 -1
- package/testing/modules/checkbox/checkbox-group-harness-filters.d.ts +0 -1
- package/testing/modules/checkbox/checkbox-harness-filters.d.ts +0 -1
- package/testing/modules/field-group/field-group-harness-filters.d.ts +0 -1
- package/testing/modules/field-group/field-group-harness.d.ts +1 -2
- package/testing/modules/file-attachment/file-attachment/file-attachment-harness-filters.d.ts +0 -1
- package/testing/modules/file-attachment/file-drop/file-drop-harness-filters.d.ts +0 -1
- package/testing/modules/file-attachment/file-drop/file-drop-harness.d.ts +90 -3
- package/testing/modules/file-attachment/file-drop/file-drop-link-upload-harness.d.ts +28 -0
- package/testing/modules/file-attachment/file-drop/file-drop-link-upload-input-harness.d.ts +14 -0
- package/testing/modules/file-attachment/file-drop/file-item-harness-filters.d.ts +10 -0
- package/testing/modules/file-attachment/file-drop/file-item-harness.d.ts +28 -0
- package/testing/modules/input-box/input-box-harness-filters.d.ts +0 -1
- package/testing/modules/input-box/input-box-harness.d.ts +1 -2
- package/testing/modules/radio/radio-group-harness-filters.d.ts +0 -1
- package/testing/modules/radio/radio-harness-filters.d.ts +0 -1
- package/testing/public-api.d.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
|
|
2
|
-
import { SkyComponentHarness, SkyQueryableComponentHarness, provideSkyFileReaderTesting } from '@skyux/core/testing';
|
|
2
|
+
import { SkyComponentHarness, SkyQueryableComponentHarness, SkyInputHarness, provideSkyFileReaderTesting } from '@skyux/core/testing';
|
|
3
3
|
import { SkyHelpInlineHarness } from '@skyux/help-inline/testing';
|
|
4
4
|
import { SkyStatusIndicatorHarness } from '@skyux/indicators/testing';
|
|
5
5
|
import { SkyPopoverHarness } from '@skyux/popovers/testing';
|
|
@@ -478,8 +478,7 @@ class SkyCheckboxHarness extends SkyComponentHarness {
|
|
|
478
478
|
* Gets the help popover content.
|
|
479
479
|
*/
|
|
480
480
|
async getHelpPopoverContent() {
|
|
481
|
-
|
|
482
|
-
return content;
|
|
481
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
483
482
|
}
|
|
484
483
|
/**
|
|
485
484
|
* Gets the help popover title.
|
|
@@ -648,8 +647,7 @@ class SkyCheckboxGroupHarness extends SkyComponentHarness {
|
|
|
648
647
|
* Gets the help popover content.
|
|
649
648
|
*/
|
|
650
649
|
async getHelpPopoverContent() {
|
|
651
|
-
|
|
652
|
-
return content;
|
|
650
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
653
651
|
}
|
|
654
652
|
/**
|
|
655
653
|
* Gets the help popover title.
|
|
@@ -850,8 +848,7 @@ class SkyFileAttachmentHarness extends SkyComponentHarness {
|
|
|
850
848
|
* Gets the help inline popover content.
|
|
851
849
|
*/
|
|
852
850
|
async getHelpPopoverContent() {
|
|
853
|
-
|
|
854
|
-
return content;
|
|
851
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
855
852
|
}
|
|
856
853
|
/**
|
|
857
854
|
* Gets the help inline popover title.
|
|
@@ -953,15 +950,78 @@ class SkyFileAttachmentHarness extends SkyComponentHarness {
|
|
|
953
950
|
}
|
|
954
951
|
|
|
955
952
|
/**
|
|
956
|
-
* Harness
|
|
953
|
+
* Harness to interact with the file drop link upload input harness.
|
|
954
|
+
*/
|
|
955
|
+
class SkyFileDropLinkUploadInputHarness extends SkyInputHarness {
|
|
956
|
+
/**
|
|
957
|
+
* @internal
|
|
958
|
+
*/
|
|
959
|
+
static { this.hostSelector = 'input.sky-form-control'; }
|
|
960
|
+
/**
|
|
961
|
+
* Gets the input aria-label
|
|
962
|
+
*/
|
|
963
|
+
async getAriaLabel() {
|
|
964
|
+
return await (await this.host()).getAttribute('aria-label');
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Harness for interacting with file drop component's link upload feature in tests.
|
|
957
970
|
* @internal
|
|
958
971
|
*/
|
|
972
|
+
class SkyFileDropLinkUploadHarness extends SkyComponentHarness {
|
|
973
|
+
/**
|
|
974
|
+
* @internal
|
|
975
|
+
*/
|
|
976
|
+
static { this.hostSelector = '.sky-file-drop-link'; }
|
|
977
|
+
#input = this.locatorFor(SkyFileDropLinkUploadInputHarness);
|
|
978
|
+
#inputBoxHarness = this.locatorFor(SkyInputBoxHarness);
|
|
979
|
+
#button = this.locatorFor('button.sky-btn-primary');
|
|
980
|
+
/**
|
|
981
|
+
* Clicks the `Done` button
|
|
982
|
+
*/
|
|
983
|
+
async clickDoneButton() {
|
|
984
|
+
if (await this.#isDoneDisabled()) {
|
|
985
|
+
throw new Error('Done button is disabled and cannot be clicked. Enter text to enable link upload.');
|
|
986
|
+
}
|
|
987
|
+
return await (await this.#button()).click();
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Enters text into the link upload input.
|
|
991
|
+
*/
|
|
992
|
+
async enterText(link) {
|
|
993
|
+
return await (await this.#input()).setValue(link);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Gets the link upload aria-label.
|
|
997
|
+
*/
|
|
998
|
+
async getAriaLabel() {
|
|
999
|
+
return await (await this.#input()).getAriaLabel();
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Gets the hint text.
|
|
1003
|
+
*/
|
|
1004
|
+
async getHintText() {
|
|
1005
|
+
return await (await this.#inputBoxHarness()).getHintText();
|
|
1006
|
+
}
|
|
1007
|
+
async #isDoneDisabled() {
|
|
1008
|
+
return (await (await this.#button()).getAttribute('disabled')) !== null;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Harness for interacting with a file drop component in tests.
|
|
1014
|
+
*/
|
|
959
1015
|
class SkyFileDropHarness extends SkyComponentHarness {
|
|
960
1016
|
/**
|
|
961
1017
|
* @internal
|
|
962
1018
|
*/
|
|
963
1019
|
static { this.hostSelector = 'sky-file-drop'; }
|
|
964
1020
|
#getDropTarget = this.locatorFor('.sky-file-drop-target');
|
|
1021
|
+
#input = this.locatorFor('input[type="file"]');
|
|
1022
|
+
#fileUploadButton = this.locatorFor('button.sky-file-drop-target');
|
|
1023
|
+
#label = this.locatorFor('.sky-file-drop-label-text');
|
|
1024
|
+
#formErrors = this.locatorForAll(SkyFormErrorsHarness);
|
|
965
1025
|
/**
|
|
966
1026
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
967
1027
|
* `SkyFileDropHarness` that meets certain criteria.
|
|
@@ -970,24 +1030,170 @@ class SkyFileDropHarness extends SkyComponentHarness {
|
|
|
970
1030
|
return SkyFileDropHarness.getDataSkyIdPredicate(filters);
|
|
971
1031
|
}
|
|
972
1032
|
/**
|
|
973
|
-
*
|
|
1033
|
+
* Clicks the file drop target.
|
|
1034
|
+
*/
|
|
1035
|
+
async clickFileDropTarget() {
|
|
1036
|
+
return await (await this.#fileUploadButton()).click();
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Clicks the help inline button.
|
|
1040
|
+
*/
|
|
1041
|
+
async clickHelpInline() {
|
|
1042
|
+
return await (await this.#getHelpInline()).click();
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Clicks the link upload `Done` button'.
|
|
1046
|
+
*/
|
|
1047
|
+
async clickLinkUploadDoneButton() {
|
|
1048
|
+
return await (await this.#getLinkUpload()).clickDoneButton();
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Enters text into the link upload input.
|
|
1052
|
+
*/
|
|
1053
|
+
async enterLinkUploadText(link) {
|
|
1054
|
+
return await (await this.#getLinkUpload()).enterText(link);
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Gets the accepted file types.
|
|
1058
|
+
*/
|
|
1059
|
+
async getAcceptedTypes() {
|
|
1060
|
+
return await (await this.#input()).getAttribute('accept');
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Gets the aria-label for the file upload button.
|
|
1064
|
+
*/
|
|
1065
|
+
async getFileUploadAriaLabel() {
|
|
1066
|
+
return await (await this.#fileUploadButton()).getAttribute('aria-label');
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Gets the help inline popover content.
|
|
974
1070
|
*/
|
|
975
|
-
async
|
|
1071
|
+
async getHelpPopoverContent() {
|
|
1072
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Gets the help inline popover title.
|
|
1076
|
+
*/
|
|
1077
|
+
async getHelpPopoverTitle() {
|
|
1078
|
+
return await (await this.#getHelpInline()).getPopoverTitle();
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Gets the hint text.
|
|
1082
|
+
*/
|
|
1083
|
+
async getHintText() {
|
|
1084
|
+
return (await (await this.locatorFor('.sky-file-drop-hint-text')()).text()).trim();
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Gets the label text.
|
|
1088
|
+
*/
|
|
1089
|
+
async getLabelText() {
|
|
1090
|
+
return (await (await this.#label()).text()).trim();
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Gets the link upload aria-label.
|
|
1094
|
+
*/
|
|
1095
|
+
async getLinkUploadAriaLabel() {
|
|
1096
|
+
return await (await this.#getLinkUpload()).getAriaLabel();
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Gets the link upload hint text.
|
|
1100
|
+
*/
|
|
1101
|
+
async getLinkUploadHintText() {
|
|
1102
|
+
return await (await this.#getLinkUpload()).getHintText();
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Whether a custom form error has fired.
|
|
1106
|
+
*/
|
|
1107
|
+
async hasCustomError(errorName) {
|
|
1108
|
+
return await (await this.#getFormErrors()).hasError(errorName);
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Whether the file type error has fired.
|
|
1112
|
+
*/
|
|
1113
|
+
async hasFileTypeError() {
|
|
1114
|
+
return await (await this.#getFormErrors()).hasError('fileType');
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Whether the max file size error has fired.
|
|
1118
|
+
*/
|
|
1119
|
+
async hasMaxFileSizeError() {
|
|
1120
|
+
return await (await this.#getFormErrors()).hasError('maxFileSize');
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Whether the min file size error has fired.
|
|
1124
|
+
*/
|
|
1125
|
+
async hasMinFileSizeError() {
|
|
1126
|
+
return await (await this.#getFormErrors()).hasError('minFileSize');
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Whether the required error has fired.
|
|
1130
|
+
*/
|
|
1131
|
+
async hasRequiredError() {
|
|
1132
|
+
return await (await this.#getFormErrors()).hasError('required');
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Whether the validate error from the customer validation has fired.
|
|
1136
|
+
*/
|
|
1137
|
+
async hasValidateFnError() {
|
|
1138
|
+
return await (await this.#getFormErrors()).hasError('validate');
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Whether label text is hidden.
|
|
1142
|
+
*/
|
|
1143
|
+
async isLabelHidden() {
|
|
1144
|
+
return await (await this.locatorFor('legend.sky-control-label')()).hasClass('sky-screen-reader-only');
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Whether file drop is required.
|
|
1148
|
+
*/
|
|
1149
|
+
async isRequired() {
|
|
1150
|
+
return await (await this.#label()).hasClass('sky-control-label-required');
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Whether file drop has stacked enabled.
|
|
1154
|
+
*/
|
|
1155
|
+
async isStacked() {
|
|
1156
|
+
return await (await this.host()).hasClass('sky-form-field-stacked');
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Loads a single file.
|
|
1160
|
+
*/
|
|
1161
|
+
async loadFile(file) {
|
|
976
1162
|
await this.#dropFiles([file]);
|
|
977
1163
|
}
|
|
978
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Loads multiple files.
|
|
1166
|
+
*/
|
|
1167
|
+
async loadFiles(files) {
|
|
1168
|
+
return await this.#dropFiles(files);
|
|
1169
|
+
}
|
|
979
1170
|
async #dropFiles(files) {
|
|
980
1171
|
const dropTarget = await this.#getDropTarget();
|
|
981
|
-
const
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
};
|
|
1172
|
+
const dataTransfer = new DataTransfer();
|
|
1173
|
+
files?.forEach((file) => {
|
|
1174
|
+
dataTransfer.items.add(file);
|
|
1175
|
+
});
|
|
985
1176
|
await dropTarget.dispatchEvent('drop', {
|
|
986
|
-
dataTransfer
|
|
987
|
-
files: fileList,
|
|
988
|
-
},
|
|
1177
|
+
dataTransfer,
|
|
989
1178
|
});
|
|
990
1179
|
}
|
|
1180
|
+
async #getFormErrors() {
|
|
1181
|
+
return (await this.#formErrors())[1];
|
|
1182
|
+
}
|
|
1183
|
+
async #getHelpInline() {
|
|
1184
|
+
const harness = await this.locatorForOptional(SkyHelpInlineHarness)();
|
|
1185
|
+
if (harness) {
|
|
1186
|
+
return harness;
|
|
1187
|
+
}
|
|
1188
|
+
throw Error('No help inline found.');
|
|
1189
|
+
}
|
|
1190
|
+
async #getLinkUpload() {
|
|
1191
|
+
const linkUpload = await this.locatorForOptional(SkyFileDropLinkUploadHarness)();
|
|
1192
|
+
if (linkUpload) {
|
|
1193
|
+
return linkUpload;
|
|
1194
|
+
}
|
|
1195
|
+
throw new Error('Link upload cannot be found. Set `allowLinks` property to `true`.');
|
|
1196
|
+
}
|
|
991
1197
|
}
|
|
992
1198
|
|
|
993
1199
|
/**
|
|
@@ -1003,6 +1209,45 @@ function provideSkyFileAttachmentTesting() {
|
|
|
1003
1209
|
return [provideSkyFileReaderTesting()];
|
|
1004
1210
|
}
|
|
1005
1211
|
|
|
1212
|
+
/**
|
|
1213
|
+
* Harness for interacting with a file item component in tests.
|
|
1214
|
+
*/
|
|
1215
|
+
class SkyFileItemHarness extends ComponentHarness {
|
|
1216
|
+
/**
|
|
1217
|
+
* @internal
|
|
1218
|
+
*/
|
|
1219
|
+
static { this.hostSelector = 'sky-file-item'; }
|
|
1220
|
+
/**
|
|
1221
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
1222
|
+
* `SkyFileItemHarness` that meets certain criteria.
|
|
1223
|
+
*/
|
|
1224
|
+
static with(filters) {
|
|
1225
|
+
return new HarnessPredicate(SkyFileItemHarness, filters).addOption('fileName', filters.fileName, async (harness, fileName) => {
|
|
1226
|
+
const harnessFileName = await harness.getFileName();
|
|
1227
|
+
return await HarnessPredicate.stringMatches(harnessFileName, fileName);
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Clicks the delete button.
|
|
1232
|
+
*/
|
|
1233
|
+
async clickDeleteButton() {
|
|
1234
|
+
return await (await this.locatorFor('.sky-file-item-btn-delete')()).click();
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Gets the file name.
|
|
1238
|
+
*/
|
|
1239
|
+
async getFileName() {
|
|
1240
|
+
return await (await this.locatorFor('.sky-file-item-name')()).text();
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Gets the file size.
|
|
1244
|
+
*/
|
|
1245
|
+
async getFileSize() {
|
|
1246
|
+
const size = await (await this.locatorFor('.sky-file-item-size')()).text();
|
|
1247
|
+
return size.substring(1, size.length - 1);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1006
1251
|
/**
|
|
1007
1252
|
* Harness for interacting with a field group component in tests.
|
|
1008
1253
|
*/
|
|
@@ -1258,12 +1503,7 @@ class SkyRadioHarness extends SkyComponentHarness {
|
|
|
1258
1503
|
* Gets the help popover content.
|
|
1259
1504
|
*/
|
|
1260
1505
|
async getHelpPopoverContent() {
|
|
1261
|
-
|
|
1262
|
-
/* istanbul ignore if */
|
|
1263
|
-
if (typeof content === 'object') {
|
|
1264
|
-
throw Error('Unexpected template ref');
|
|
1265
|
-
}
|
|
1266
|
-
return content;
|
|
1506
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
1267
1507
|
}
|
|
1268
1508
|
/**
|
|
1269
1509
|
* Gets the help popover title.
|
|
@@ -1425,12 +1665,7 @@ class SkyRadioGroupHarness extends SkyComponentHarness {
|
|
|
1425
1665
|
* Gets the help popover content.
|
|
1426
1666
|
*/
|
|
1427
1667
|
async getHelpPopoverContent() {
|
|
1428
|
-
|
|
1429
|
-
/* istanbul ignore if */
|
|
1430
|
-
if (typeof content === 'object') {
|
|
1431
|
-
throw Error('Unexpected template ref');
|
|
1432
|
-
}
|
|
1433
|
-
return content;
|
|
1668
|
+
return await (await this.#getHelpInline()).getPopoverContent();
|
|
1434
1669
|
}
|
|
1435
1670
|
/**
|
|
1436
1671
|
* Gets the help popover title.
|
|
@@ -1494,5 +1729,5 @@ class SkyRadioGroupHarness extends SkyComponentHarness {
|
|
|
1494
1729
|
* Generated bundle index. Do not edit.
|
|
1495
1730
|
*/
|
|
1496
1731
|
|
|
1497
|
-
export { SkyCharacterCounterIndicatorHarness, SkyCheckboxFixture, SkyCheckboxGroupHarness, SkyCheckboxHarness, SkyCheckboxLabelHarness, SkyFieldGroupHarness, SkyFileAttachmentHarness, SkyFileDropHarness, SkyFormErrorHarness, SkyFormErrorsHarness, SkyInputBoxHarness, SkyRadioFixture, SkyRadioGroupHarness, SkyRadioHarness, SkyRadioLabelHarness, provideSkyFileAttachmentTesting };
|
|
1732
|
+
export { SkyCharacterCounterIndicatorHarness, SkyCheckboxFixture, SkyCheckboxGroupHarness, SkyCheckboxHarness, SkyCheckboxLabelHarness, SkyFieldGroupHarness, SkyFileAttachmentHarness, SkyFileDropHarness, SkyFileItemHarness, SkyFormErrorHarness, SkyFormErrorsHarness, SkyInputBoxHarness, SkyRadioFixture, SkyRadioGroupHarness, SkyRadioHarness, SkyRadioLabelHarness, provideSkyFileAttachmentTesting };
|
|
1498
1733
|
//# sourceMappingURL=skyux-forms-testing.mjs.map
|