@skyux/forms 11.35.0 → 11.36.1
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 +4561 -1839
- package/esm2022/lib/modules/file-attachment/file-drop/file-drop.component.mjs +3 -3
- package/esm2022/testing/modules/file-attachment/file-drop/file-drop-harness.mjs +165 -12
- package/esm2022/testing/modules/file-attachment/file-drop/file-drop-link-upload-harness.mjs +47 -0
- package/esm2022/testing/modules/file-attachment/file-drop/file-drop-link-upload-input-harness.mjs +17 -0
- package/esm2022/testing/modules/file-attachment/file-drop/file-item-harness-filters.mjs +2 -0
- package/esm2022/testing/modules/file-attachment/file-drop/file-item-harness.mjs +40 -0
- package/esm2022/testing/public-api.mjs +2 -1
- package/fesm2022/skyux-forms-testing.mjs +262 -13
- package/fesm2022/skyux-forms-testing.mjs.map +1 -1
- package/fesm2022/skyux-forms.mjs +2 -2
- package/fesm2022/skyux-forms.mjs.map +1 -1
- package/lib/modules/file-attachment/file-drop/file-drop.component.d.ts +1 -1
- package/package.json +9 -9
- 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/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';
|
|
@@ -962,15 +962,78 @@ class SkyFileAttachmentHarness extends SkyComponentHarness {
|
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
/**
|
|
965
|
-
* Harness
|
|
965
|
+
* Harness to interact with the file drop link upload input harness.
|
|
966
|
+
*/
|
|
967
|
+
class SkyFileDropLinkUploadInputHarness extends SkyInputHarness {
|
|
968
|
+
/**
|
|
969
|
+
* @internal
|
|
970
|
+
*/
|
|
971
|
+
static { this.hostSelector = 'input.sky-form-control'; }
|
|
972
|
+
/**
|
|
973
|
+
* Gets the input aria-label
|
|
974
|
+
*/
|
|
975
|
+
async getAriaLabel() {
|
|
976
|
+
return await (await this.host()).getAttribute('aria-label');
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Harness for interacting with file drop component's link upload feature in tests.
|
|
966
982
|
* @internal
|
|
967
983
|
*/
|
|
984
|
+
class SkyFileDropLinkUploadHarness extends SkyComponentHarness {
|
|
985
|
+
/**
|
|
986
|
+
* @internal
|
|
987
|
+
*/
|
|
988
|
+
static { this.hostSelector = '.sky-file-drop-link'; }
|
|
989
|
+
#input = this.locatorFor(SkyFileDropLinkUploadInputHarness);
|
|
990
|
+
#inputBoxHarness = this.locatorFor(SkyInputBoxHarness);
|
|
991
|
+
#button = this.locatorFor('button.sky-btn-primary');
|
|
992
|
+
/**
|
|
993
|
+
* Clicks the `Done` button
|
|
994
|
+
*/
|
|
995
|
+
async clickDoneButton() {
|
|
996
|
+
if (await this.#isDoneDisabled()) {
|
|
997
|
+
throw new Error('Done button is disabled and cannot be clicked. Enter text to enable link upload.');
|
|
998
|
+
}
|
|
999
|
+
return await (await this.#button()).click();
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Enters text into the link upload input.
|
|
1003
|
+
*/
|
|
1004
|
+
async enterText(link) {
|
|
1005
|
+
return await (await this.#input()).setValue(link);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Gets the link upload aria-label.
|
|
1009
|
+
*/
|
|
1010
|
+
async getAriaLabel() {
|
|
1011
|
+
return await (await this.#input()).getAriaLabel();
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Gets the hint text.
|
|
1015
|
+
*/
|
|
1016
|
+
async getHintText() {
|
|
1017
|
+
return await (await this.#inputBoxHarness()).getHintText();
|
|
1018
|
+
}
|
|
1019
|
+
async #isDoneDisabled() {
|
|
1020
|
+
return (await (await this.#button()).getAttribute('disabled')) !== null;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Harness for interacting with a file drop component in tests.
|
|
1026
|
+
*/
|
|
968
1027
|
class SkyFileDropHarness extends SkyComponentHarness {
|
|
969
1028
|
/**
|
|
970
1029
|
* @internal
|
|
971
1030
|
*/
|
|
972
1031
|
static { this.hostSelector = 'sky-file-drop'; }
|
|
973
1032
|
#getDropTarget = this.locatorFor('.sky-file-drop-target');
|
|
1033
|
+
#input = this.locatorFor('input[type="file"]');
|
|
1034
|
+
#fileUploadButton = this.locatorFor('button.sky-file-drop-target');
|
|
1035
|
+
#label = this.locatorFor('.sky-file-drop-label-text');
|
|
1036
|
+
#formErrors = this.locatorForAll(SkyFormErrorsHarness);
|
|
974
1037
|
/**
|
|
975
1038
|
* Gets a `HarnessPredicate` that can be used to search for a
|
|
976
1039
|
* `SkyFileDropHarness` that meets certain criteria.
|
|
@@ -979,24 +1042,171 @@ class SkyFileDropHarness extends SkyComponentHarness {
|
|
|
979
1042
|
return SkyFileDropHarness.getDataSkyIdPredicate(filters);
|
|
980
1043
|
}
|
|
981
1044
|
/**
|
|
982
|
-
*
|
|
1045
|
+
* Clicks the file drop target.
|
|
983
1046
|
*/
|
|
984
|
-
async
|
|
1047
|
+
async clickFileDropTarget() {
|
|
1048
|
+
return await (await this.#fileUploadButton()).click();
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Clicks the help inline button.
|
|
1052
|
+
*/
|
|
1053
|
+
async clickHelpInline() {
|
|
1054
|
+
return await (await this.#getHelpInline()).click();
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Clicks the link upload `Done` button'.
|
|
1058
|
+
*/
|
|
1059
|
+
async clickLinkUploadDoneButton() {
|
|
1060
|
+
return await (await this.#getLinkUpload()).clickDoneButton();
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Enters text into the link upload input.
|
|
1064
|
+
*/
|
|
1065
|
+
async enterLinkUploadText(link) {
|
|
1066
|
+
return await (await this.#getLinkUpload()).enterText(link);
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Gets the accepted file types.
|
|
1070
|
+
*/
|
|
1071
|
+
async getAcceptedTypes() {
|
|
1072
|
+
return await (await this.#input()).getAttribute('accept');
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Gets the aria-label for the file upload button.
|
|
1076
|
+
*/
|
|
1077
|
+
async getFileUploadAriaLabel() {
|
|
1078
|
+
return await (await this.#fileUploadButton()).getAttribute('aria-label');
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Gets the help inline popover content.
|
|
1082
|
+
*/
|
|
1083
|
+
async getHelpPopoverContent() {
|
|
1084
|
+
const content = await (await this.#getHelpInline()).getPopoverContent();
|
|
1085
|
+
return content;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Gets the help inline popover title.
|
|
1089
|
+
*/
|
|
1090
|
+
async getHelpPopoverTitle() {
|
|
1091
|
+
return await (await this.#getHelpInline()).getPopoverTitle();
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Gets the hint text.
|
|
1095
|
+
*/
|
|
1096
|
+
async getHintText() {
|
|
1097
|
+
return (await (await this.locatorFor('.sky-file-drop-hint-text')()).text()).trim();
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Gets the label text.
|
|
1101
|
+
*/
|
|
1102
|
+
async getLabelText() {
|
|
1103
|
+
return (await (await this.#label()).text()).trim();
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Gets the link upload aria-label.
|
|
1107
|
+
*/
|
|
1108
|
+
async getLinkUploadAriaLabel() {
|
|
1109
|
+
return await (await this.#getLinkUpload()).getAriaLabel();
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Gets the link upload hint text.
|
|
1113
|
+
*/
|
|
1114
|
+
async getLinkUploadHintText() {
|
|
1115
|
+
return await (await this.#getLinkUpload()).getHintText();
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Whether a custom form error has fired.
|
|
1119
|
+
*/
|
|
1120
|
+
async hasCustomError(errorName) {
|
|
1121
|
+
return await (await this.#getFormErrors()).hasError(errorName);
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Whether the file type error has fired.
|
|
1125
|
+
*/
|
|
1126
|
+
async hasFileTypeError() {
|
|
1127
|
+
return await (await this.#getFormErrors()).hasError('fileType');
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Whether the max file size error has fired.
|
|
1131
|
+
*/
|
|
1132
|
+
async hasMaxFileSizeError() {
|
|
1133
|
+
return await (await this.#getFormErrors()).hasError('maxFileSize');
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Whether the min file size error has fired.
|
|
1137
|
+
*/
|
|
1138
|
+
async hasMinFileSizeError() {
|
|
1139
|
+
return await (await this.#getFormErrors()).hasError('minFileSize');
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Whether the required error has fired.
|
|
1143
|
+
*/
|
|
1144
|
+
async hasRequiredError() {
|
|
1145
|
+
return await (await this.#getFormErrors()).hasError('required');
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Whether the validate error from the customer validation has fired.
|
|
1149
|
+
*/
|
|
1150
|
+
async hasValidateFnError() {
|
|
1151
|
+
return await (await this.#getFormErrors()).hasError('validate');
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Whether label text is hidden.
|
|
1155
|
+
*/
|
|
1156
|
+
async isLabelHidden() {
|
|
1157
|
+
return await (await this.locatorFor('legend.sky-control-label')()).hasClass('sky-screen-reader-only');
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Whether file drop is required.
|
|
1161
|
+
*/
|
|
1162
|
+
async isRequired() {
|
|
1163
|
+
return await (await this.#label()).hasClass('sky-control-label-required');
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Whether file drop has stacked enabled.
|
|
1167
|
+
*/
|
|
1168
|
+
async isStacked() {
|
|
1169
|
+
return await (await this.host()).hasClass('sky-form-field-stacked');
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Loads a single file.
|
|
1173
|
+
*/
|
|
1174
|
+
async loadFile(file) {
|
|
985
1175
|
await this.#dropFiles([file]);
|
|
986
1176
|
}
|
|
987
|
-
|
|
1177
|
+
/**
|
|
1178
|
+
* Loads multiple files.
|
|
1179
|
+
*/
|
|
1180
|
+
async loadFiles(files) {
|
|
1181
|
+
return await this.#dropFiles(files);
|
|
1182
|
+
}
|
|
988
1183
|
async #dropFiles(files) {
|
|
989
1184
|
const dropTarget = await this.#getDropTarget();
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
};
|
|
1185
|
+
const dataTransfer = new DataTransfer();
|
|
1186
|
+
files?.forEach((file) => {
|
|
1187
|
+
dataTransfer.items.add(file);
|
|
1188
|
+
});
|
|
994
1189
|
await dropTarget.dispatchEvent('drop', {
|
|
995
|
-
dataTransfer
|
|
996
|
-
files: fileList,
|
|
997
|
-
},
|
|
1190
|
+
dataTransfer,
|
|
998
1191
|
});
|
|
999
1192
|
}
|
|
1193
|
+
async #getFormErrors() {
|
|
1194
|
+
return (await this.#formErrors())[1];
|
|
1195
|
+
}
|
|
1196
|
+
async #getHelpInline() {
|
|
1197
|
+
const harness = await this.locatorForOptional(SkyHelpInlineHarness)();
|
|
1198
|
+
if (harness) {
|
|
1199
|
+
return harness;
|
|
1200
|
+
}
|
|
1201
|
+
throw Error('No help inline found.');
|
|
1202
|
+
}
|
|
1203
|
+
async #getLinkUpload() {
|
|
1204
|
+
const linkUpload = await this.locatorForOptional(SkyFileDropLinkUploadHarness)();
|
|
1205
|
+
if (linkUpload) {
|
|
1206
|
+
return linkUpload;
|
|
1207
|
+
}
|
|
1208
|
+
throw new Error('Link upload cannot be found. Set `allowLinks` property to `true`.');
|
|
1209
|
+
}
|
|
1000
1210
|
}
|
|
1001
1211
|
|
|
1002
1212
|
/**
|
|
@@ -1012,6 +1222,45 @@ function provideSkyFileAttachmentTesting() {
|
|
|
1012
1222
|
return [provideSkyFileReaderTesting()];
|
|
1013
1223
|
}
|
|
1014
1224
|
|
|
1225
|
+
/**
|
|
1226
|
+
* Harness for interacting with a file item component in tests.
|
|
1227
|
+
*/
|
|
1228
|
+
class SkyFileItemHarness extends ComponentHarness {
|
|
1229
|
+
/**
|
|
1230
|
+
* @internal
|
|
1231
|
+
*/
|
|
1232
|
+
static { this.hostSelector = 'sky-file-item'; }
|
|
1233
|
+
/**
|
|
1234
|
+
* Gets a `HarnessPredicate` that can be used to search for a
|
|
1235
|
+
* `SkyFileItemHarness` that meets certain criteria.
|
|
1236
|
+
*/
|
|
1237
|
+
static with(filters) {
|
|
1238
|
+
return new HarnessPredicate(SkyFileItemHarness, filters).addOption('fileName', filters.fileName, async (harness, fileName) => {
|
|
1239
|
+
const harnessFileName = await harness.getFileName();
|
|
1240
|
+
return await HarnessPredicate.stringMatches(harnessFileName, fileName);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Clicks the delete button.
|
|
1245
|
+
*/
|
|
1246
|
+
async clickDeleteButton() {
|
|
1247
|
+
return await (await this.locatorFor('.sky-file-item-btn-delete')()).click();
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Gets the file name.
|
|
1251
|
+
*/
|
|
1252
|
+
async getFileName() {
|
|
1253
|
+
return await (await this.locatorFor('.sky-file-item-name')()).text();
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Gets the file size.
|
|
1257
|
+
*/
|
|
1258
|
+
async getFileSize() {
|
|
1259
|
+
const size = await (await this.locatorFor('.sky-file-item-size')()).text();
|
|
1260
|
+
return size.substring(1, size.length - 1);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1015
1264
|
/**
|
|
1016
1265
|
* Harness for interacting with a field group component in tests.
|
|
1017
1266
|
*/
|
|
@@ -1503,5 +1752,5 @@ class SkyRadioGroupHarness extends SkyComponentHarness {
|
|
|
1503
1752
|
* Generated bundle index. Do not edit.
|
|
1504
1753
|
*/
|
|
1505
1754
|
|
|
1506
|
-
export { SkyCharacterCounterIndicatorHarness, SkyCheckboxFixture, SkyCheckboxGroupHarness, SkyCheckboxHarness, SkyCheckboxLabelHarness, SkyFieldGroupHarness, SkyFileAttachmentHarness, SkyFileDropHarness, SkyFormErrorHarness, SkyFormErrorsHarness, SkyInputBoxHarness, SkyRadioFixture, SkyRadioGroupHarness, SkyRadioHarness, SkyRadioLabelHarness, provideSkyFileAttachmentTesting };
|
|
1755
|
+
export { SkyCharacterCounterIndicatorHarness, SkyCheckboxFixture, SkyCheckboxGroupHarness, SkyCheckboxHarness, SkyCheckboxLabelHarness, SkyFieldGroupHarness, SkyFileAttachmentHarness, SkyFileDropHarness, SkyFileItemHarness, SkyFormErrorHarness, SkyFormErrorsHarness, SkyInputBoxHarness, SkyRadioFixture, SkyRadioGroupHarness, SkyRadioHarness, SkyRadioLabelHarness, provideSkyFileAttachmentTesting };
|
|
1507
1756
|
//# sourceMappingURL=skyux-forms-testing.mjs.map
|