learningtribes-studio-frontend 1.4.2-alpha.0 → 1.4.2-alpha.2
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/accessibilityPolicy.min.js +2 -2
- package/dist/assets.min.css +1 -1
- package/dist/assets.min.js +1 -1
- package/dist/assets.min.js.map +1 -1
- package/dist/common.min.css +2 -2
- package/dist/common.min.js +9 -9
- package/dist/common.min.js.map +1 -1
- package/dist/courseHealthCheck.min.js +1 -1
- package/dist/courseOutlineHealthCheck.min.js +1 -1
- package/dist/editImageModal.min.css +1 -1
- package/dist/editImageModal.min.js +1 -1
- package/dist/editImageModal.min.js.map +1 -1
- package/dist/i18n/messages/ar.json +0 -3
- package/dist/i18n/messages/es_419.json +0 -3
- package/dist/i18n/messages/fr.json +0 -3
- package/dist/i18n/messages/zh_CN.json +0 -3
- package/dist/i18nMessages.min.js +1 -1
- package/dist/i18nMessages.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AssetsDropZone/AssetsDropZone.scss +49 -59
- package/src/components/AssetsDropZone/AssetsDropZone.test.jsx +1 -1
- package/src/components/AssetsDropZone/index.jsx +15 -19
- package/src/components/AssetsList/AssetsList.scss +48 -41
- package/src/components/AssetsList/index.jsx +9 -4
- package/src/components/EditImageModal/EditImageModal.scss +59 -35
- package/src/components/EditImageModal/EditImageModal.test.jsx +27 -176
- package/src/components/EditImageModal/displayMessages.jsx +6 -16
- package/src/components/EditImageModal/index.jsx +40 -88
- package/src/data/i18n/default/transifex_input.json +3 -5
- package/src/data/i18n/locales/ar.json +0 -3
- package/src/data/i18n/locales/es_419.json +0 -3
- package/src/data/i18n/locales/fr.json +0 -3
- package/src/data/i18n/locales/zh_CN.json +0 -3
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
.modal-dialog {
|
|
9
9
|
max-width: $modal-lg;
|
|
10
|
+
margin: 40px auto;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
// --- Copied from: https://github.com/edx/paragon/blob/master/src/Fieldset/Fieldset.scss
|
|
@@ -17,6 +18,12 @@
|
|
|
17
18
|
width: auto;
|
|
18
19
|
margin-bottom: 0;
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
fieldset {
|
|
23
|
+
border: none;
|
|
24
|
+
padding: 0;
|
|
25
|
+
margin: 0;
|
|
26
|
+
}
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
.form-control.is-invalid.is-invalid-nodanger {
|
|
@@ -78,71 +85,88 @@
|
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
.modal-body {
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
form.image-fields {
|
|
89
|
+
fieldset {
|
|
90
|
+
border: 0;
|
|
91
|
+
padding: 0;
|
|
92
|
+
margin: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fieldset legend {
|
|
96
|
+
position: absolute;
|
|
97
|
+
width: 1px;
|
|
98
|
+
height: 1px;
|
|
99
|
+
padding: 0;
|
|
100
|
+
margin: -1px;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
clip: rect(0, 0, 0, 0);
|
|
103
|
+
border: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
.paragon-fieldset {
|
|
84
107
|
margin-bottom: 1.5rem;
|
|
85
|
-
|
|
86
|
-
fieldset {
|
|
87
|
-
legend {
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
font-weight: 500;
|
|
90
|
-
color: #333;
|
|
91
|
-
margin-bottom: 0.5rem;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
.form-group {
|
|
97
|
-
margin-bottom:
|
|
111
|
+
margin-bottom: 0;
|
|
98
112
|
|
|
99
113
|
label {
|
|
114
|
+
display: block;
|
|
100
115
|
font-size: 14px;
|
|
101
116
|
font-weight: 500;
|
|
102
|
-
color: #
|
|
117
|
+
color: #09092d;
|
|
118
|
+
margin-bottom: 8px;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
121
|
.form-control {
|
|
106
|
-
border-radius:
|
|
107
|
-
border: 1px solid #
|
|
108
|
-
padding:
|
|
122
|
+
border-radius: 4px;
|
|
123
|
+
border: 1px solid #d7d7e4;
|
|
124
|
+
padding: 12px 16px;
|
|
109
125
|
font-size: 14px;
|
|
126
|
+
color: #09092d;
|
|
127
|
+
width: 100%;
|
|
110
128
|
|
|
111
129
|
&:focus {
|
|
112
|
-
border-color: #
|
|
113
|
-
box-shadow: 0 0 0 2px
|
|
130
|
+
border-color: #5959eb;
|
|
131
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #5959eb;
|
|
114
132
|
}
|
|
115
133
|
}
|
|
116
134
|
|
|
117
|
-
.form-text
|
|
135
|
+
.form-text,
|
|
136
|
+
small {
|
|
137
|
+
display: block;
|
|
118
138
|
font-size: 12px;
|
|
119
|
-
color: #
|
|
139
|
+
color: #1f1f59;
|
|
120
140
|
margin-top: 4px;
|
|
121
141
|
}
|
|
122
142
|
}
|
|
123
143
|
}
|
|
124
144
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
.dimensions-row {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: flex-end;
|
|
148
|
+
gap: 12px;
|
|
149
|
+
margin-top: 20px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.dimension-field {
|
|
153
|
+
flex: 1;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.dimensions-separator {
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
padding-bottom: 10px;
|
|
160
|
+
color: #1f1f59;
|
|
161
|
+
font-size: 14px;
|
|
135
162
|
}
|
|
136
163
|
}
|
|
137
164
|
|
|
138
|
-
// Checkbox
|
|
139
165
|
.form-check {
|
|
140
|
-
|
|
141
|
-
margin-top: 0.25rem;
|
|
142
|
-
}
|
|
166
|
+
margin-top: 16px;
|
|
143
167
|
|
|
144
168
|
.form-check-label {
|
|
145
169
|
font-size: 14px;
|
|
146
|
-
color: #
|
|
170
|
+
color: #09092d;
|
|
147
171
|
}
|
|
148
172
|
}
|
|
@@ -47,9 +47,6 @@ const getImageDescriptionFieldset = editImageModal =>
|
|
|
47
47
|
(getFormContainer(editImageModal).find(Fieldset).at(0));
|
|
48
48
|
const getImageDescriptionInput = editImageModal =>
|
|
49
49
|
(getImageDescriptionFieldset(editImageModal).find(InputText));
|
|
50
|
-
const getImageDescriptionInputCheckBox = editImageModal =>
|
|
51
|
-
(getImageDescriptionFieldset(editImageModal).find(CheckBox));
|
|
52
|
-
|
|
53
50
|
const getImageDimensionsFieldset = editImageModal =>
|
|
54
51
|
(getFormContainer(editImageModal).find(Fieldset).at(1));
|
|
55
52
|
const getImageDimensionsWidthInput = editImageModal =>
|
|
@@ -112,31 +109,31 @@ describe('EditImageModal', () => {
|
|
|
112
109
|
});
|
|
113
110
|
});
|
|
114
111
|
|
|
115
|
-
it('a
|
|
112
|
+
it('a Save button', () => {
|
|
116
113
|
expect(getNextPageButton(editImageModal)).toHaveLength(1);
|
|
117
114
|
});
|
|
118
115
|
|
|
119
|
-
it('a
|
|
120
|
-
const
|
|
116
|
+
it('a Save button with correct label', () => {
|
|
117
|
+
const saveButton = getNextPageButton(editImageModal);
|
|
121
118
|
|
|
122
|
-
const
|
|
123
|
-
expect(
|
|
119
|
+
const saveButtonText = shallowWithIntl(saveButton.prop('label'));
|
|
120
|
+
expect(saveButtonText.prop('message')).toEqual(messages.editImageModalInsertImageButton);
|
|
124
121
|
});
|
|
125
122
|
|
|
126
|
-
it('a disabled
|
|
127
|
-
const
|
|
123
|
+
it('a disabled Save button', () => {
|
|
124
|
+
const saveButton = getNextPageButton(editImageModal);
|
|
128
125
|
|
|
129
|
-
expect(
|
|
126
|
+
expect(saveButton.prop('disabled')).toEqual(true);
|
|
130
127
|
});
|
|
131
128
|
|
|
132
|
-
it('a not disabled
|
|
129
|
+
it('a not disabled Save button when asset selected', () => {
|
|
133
130
|
editImageModal.setProps({
|
|
134
131
|
selectedAsset: testAssetsList[0],
|
|
135
132
|
});
|
|
136
133
|
|
|
137
|
-
const
|
|
134
|
+
const saveButton = getNextPageButton(editImageModal);
|
|
138
135
|
|
|
139
|
-
expect(
|
|
136
|
+
expect(saveButton.prop('disabled')).toEqual(false);
|
|
140
137
|
});
|
|
141
138
|
});
|
|
142
139
|
});
|
|
@@ -323,9 +320,11 @@ describe('EditImageModal', () => {
|
|
|
323
320
|
expect(header.prop('message')).toEqual(messages.editImageModalInsertHeader);
|
|
324
321
|
});
|
|
325
322
|
|
|
326
|
-
it('
|
|
327
|
-
|
|
328
|
-
.prop('message')
|
|
323
|
+
it('no empty-state message', () => {
|
|
324
|
+
const emptyMessage = getModalBody(editImageModal).find(WrappedMessage).filterWhere(
|
|
325
|
+
message => message.prop('message') === messages.editImageModalAssetsListNoAssetsMessage,
|
|
326
|
+
);
|
|
327
|
+
expect(emptyMessage).toHaveLength(0);
|
|
329
328
|
});
|
|
330
329
|
|
|
331
330
|
it('no AssetsList component', () => {
|
|
@@ -488,36 +487,6 @@ describe('EditImageModal', () => {
|
|
|
488
487
|
});
|
|
489
488
|
});
|
|
490
489
|
|
|
491
|
-
describe('a image description CheckBox with', () => {
|
|
492
|
-
it('a CheckBox', () => {
|
|
493
|
-
expect(getImageDescriptionInputCheckBox(editImageModal)).toHaveLength(1);
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
it('correct initial props', () => {
|
|
497
|
-
const imageDescriptionInputCheckbox =
|
|
498
|
-
getImageDescriptionInputCheckBox(editImageModal);
|
|
499
|
-
|
|
500
|
-
expect(imageDescriptionInputCheckbox.prop('id')).toEqual('isDecorative');
|
|
501
|
-
expect(imageDescriptionInputCheckbox.prop('id')).toEqual('isDecorative');
|
|
502
|
-
|
|
503
|
-
expect(shallowWithIntl(imageDescriptionInputCheckbox.prop('label')).prop('message'))
|
|
504
|
-
.toEqual(messages.editImageModalImageIsDecorativeCheckboxLabel);
|
|
505
|
-
|
|
506
|
-
expect(imageDescriptionInputCheckbox.prop('checked')).toEqual(false);
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
it('a Learn More link in description', () => {
|
|
510
|
-
/*
|
|
511
|
-
Due to Enzyme issue #1213, we must wrap React Fragments in a div in order
|
|
512
|
-
to succesfully shallow them. Once Enzyme introduces support for React Fragments,
|
|
513
|
-
we can remove the extraneous div.
|
|
514
|
-
*/
|
|
515
|
-
const imageDescriptionInputCheckBoxDescriptionMessages = shallowWithIntl(<div>{getImageDescriptionInputCheckBox(editImageModal).prop('description')}</div>).find(WrappedMessage);
|
|
516
|
-
expect(imageDescriptionInputCheckBoxDescriptionMessages.at(1).prop('children')().type).toEqual('a');
|
|
517
|
-
expect(imageDescriptionInputCheckBoxDescriptionMessages.at(1).prop('message'))
|
|
518
|
-
.toEqual(messages.editImageModalLearnMore);
|
|
519
|
-
});
|
|
520
|
-
});
|
|
521
490
|
});
|
|
522
491
|
|
|
523
492
|
describe('an imageDimensions Fieldset with', () => {
|
|
@@ -539,8 +508,8 @@ describe('EditImageModal', () => {
|
|
|
539
508
|
});
|
|
540
509
|
});
|
|
541
510
|
|
|
542
|
-
it('a
|
|
543
|
-
expect(getImageDimensionsFieldset(editImageModal).find('div.
|
|
511
|
+
it('a dimensions row', () => {
|
|
512
|
+
expect(getImageDimensionsFieldset(editImageModal).find('div.dimensions-row')).toHaveLength(1);
|
|
544
513
|
});
|
|
545
514
|
|
|
546
515
|
describe('an imageDimensions width InputText with', () => {
|
|
@@ -620,7 +589,6 @@ describe('EditImageModal', () => {
|
|
|
620
589
|
expect(editImageModal.state('imageDimensions')).toEqual({});
|
|
621
590
|
expect(editImageModal.state('imageSource')).toEqual('');
|
|
622
591
|
expect(editImageModal.state('imageStyle')).toEqual('');
|
|
623
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(false);
|
|
624
592
|
expect(editImageModal.state('isImageDescriptionValid')).toEqual(true);
|
|
625
593
|
expect(editImageModal.state('isImageLoaded')).toEqual(false);
|
|
626
594
|
expect(editImageModal.state('isImageLoading')).toEqual(false);
|
|
@@ -648,7 +616,6 @@ describe('EditImageModal', () => {
|
|
|
648
616
|
expect(editImageModal.state('imageDimensions')).toEqual({});
|
|
649
617
|
expect(editImageModal.state('imageSource')).toEqual('');
|
|
650
618
|
expect(editImageModal.state('imageStyle')).toEqual('');
|
|
651
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(false);
|
|
652
619
|
expect(editImageModal.state('isImageDescriptionValid')).toEqual(true);
|
|
653
620
|
expect(editImageModal.state('isImageLoaded')).toEqual(false);
|
|
654
621
|
expect(editImageModal.state('isImageLoading')).toEqual(false);
|
|
@@ -672,7 +639,6 @@ describe('EditImageModal', () => {
|
|
|
672
639
|
expect(editImageModal.state('imageDimensions')).toEqual({});
|
|
673
640
|
expect(editImageModal.state('imageSource')).toEqual('');
|
|
674
641
|
expect(editImageModal.state('imageStyle')).toEqual('');
|
|
675
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(false);
|
|
676
642
|
expect(editImageModal.state('isImageDescriptionValid')).toEqual(true);
|
|
677
643
|
expect(editImageModal.state('isImageLoaded')).toEqual(false);
|
|
678
644
|
expect(editImageModal.state('isImageLoading')).toEqual(false);
|
|
@@ -712,7 +678,6 @@ describe('EditImageModal', () => {
|
|
|
712
678
|
});
|
|
713
679
|
expect(editImageModal.state('imageStyle')).toEqual(sampleText);
|
|
714
680
|
expect(editImageModal.state('imageSource')).toEqual(sampleText);
|
|
715
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(false);
|
|
716
681
|
expect(editImageModal.state('isImageDescriptionValid')).toEqual(true);
|
|
717
682
|
expect(editImageModal.state('isImageLoaded')).toEqual(true);
|
|
718
683
|
expect(editImageModal.state('isImageLoading')).toEqual(false);
|
|
@@ -956,23 +921,6 @@ describe('EditImageModal', () => {
|
|
|
956
921
|
expect(editImageModal.state('currentValidationMessages')).toEqual({});
|
|
957
922
|
});
|
|
958
923
|
|
|
959
|
-
it('this.state.currentValidationMessages has correct validation messages when invalid form submitted', () => {
|
|
960
|
-
getInsertImageButton(editImageModal).simulate('click');
|
|
961
|
-
|
|
962
|
-
expect(editImageModal.state('currentValidationMessages').imageDescription.props.message).toEqual(messages.editImageModalFormValidImageDescription);
|
|
963
|
-
});
|
|
964
|
-
|
|
965
|
-
it('this.state.currentValidationMessages has correct validation message when invalid image description submitted', () => {
|
|
966
|
-
editImageModal.setState({
|
|
967
|
-
imageSource: sampleText,
|
|
968
|
-
});
|
|
969
|
-
|
|
970
|
-
getInsertImageButton(editImageModal).simulate('click');
|
|
971
|
-
|
|
972
|
-
expect(editImageModal.state('currentValidationMessages')).not.toHaveProperty('imageDimensions');
|
|
973
|
-
expect(editImageModal.state('currentValidationMessages').imageDescription.props.message).toEqual(messages.editImageModalFormValidImageDescription);
|
|
974
|
-
});
|
|
975
|
-
|
|
976
924
|
it('this.state.currentValidationMessages has correct validation message when invalid image dimensions submitted', () => {
|
|
977
925
|
editImageModal.setState({
|
|
978
926
|
imageSource: sampleText,
|
|
@@ -1008,7 +956,7 @@ describe('EditImageModal', () => {
|
|
|
1008
956
|
expect(editImageModal.state('currentValidationMessages')).not.toHaveProperty('imageDescription');
|
|
1009
957
|
});
|
|
1010
958
|
|
|
1011
|
-
it('status alert has correct validation
|
|
959
|
+
it('status alert has correct validation message when invalid dimensions submitted', () => {
|
|
1012
960
|
editImageModal.setState({
|
|
1013
961
|
imageDimensions: {
|
|
1014
962
|
height: (-1 * sampleImgData.naturalHeight),
|
|
@@ -1021,9 +969,8 @@ describe('EditImageModal', () => {
|
|
|
1021
969
|
editImageModal.update();
|
|
1022
970
|
|
|
1023
971
|
const statusAlertListItems = shallowWithIntl(getStatusAlert(editImageModal).prop('dialog')).find('div ul.bullet-list li a');
|
|
1024
|
-
expect(statusAlertListItems).toHaveLength(
|
|
1025
|
-
expect(statusAlertListItems.at(0).find(WrappedMessage).prop('message')).toEqual(messages.
|
|
1026
|
-
expect(statusAlertListItems.at(1).find(WrappedMessage).prop('message')).toEqual(messages.editImageModalFormValidImageDimensions);
|
|
972
|
+
expect(statusAlertListItems).toHaveLength(1);
|
|
973
|
+
expect(statusAlertListItems.at(0).find(WrappedMessage).prop('message')).toEqual(messages.editImageModalFormValidImageDimensions);
|
|
1027
974
|
});
|
|
1028
975
|
|
|
1029
976
|
it('validation messages are hyperlinks that navigate to appropriate form elements', () => {
|
|
@@ -1040,32 +987,8 @@ describe('EditImageModal', () => {
|
|
|
1040
987
|
editImageModal.update();
|
|
1041
988
|
|
|
1042
989
|
const statusAlertListItems = shallowWithIntl(getStatusAlert(editImageModal).prop('dialog')).find('div ul.bullet-list li a');
|
|
1043
|
-
expect(statusAlertListItems).toHaveLength(2);
|
|
1044
|
-
expect(statusAlertListItems.at(0).prop('href')).toEqual('#imageDescription');
|
|
1045
|
-
expect(statusAlertListItems.at(1).prop('href')).toEqual('#imageWidth');
|
|
1046
|
-
});
|
|
1047
|
-
|
|
1048
|
-
it('status alert has correct validation message when invalid image description submitted', () => {
|
|
1049
|
-
editImageModal.setState({
|
|
1050
|
-
imageSource: sampleText,
|
|
1051
|
-
});
|
|
1052
|
-
|
|
1053
|
-
getModalBody(editImageModal).find('img').simulate('load', { target: { ...sampleImgData } });
|
|
1054
|
-
|
|
1055
|
-
getInsertImageButton(editImageModal).simulate('click');
|
|
1056
|
-
|
|
1057
|
-
editImageModal.update();
|
|
1058
|
-
|
|
1059
|
-
const statusAlert = getStatusAlert(editImageModal);
|
|
1060
|
-
|
|
1061
|
-
const validationMessages = shallowWithIntl(statusAlert.prop('dialog')).find(WrappedMessage);
|
|
1062
|
-
expect(validationMessages).toHaveLength(2);
|
|
1063
|
-
expect(validationMessages.at(0).prop('message')).toEqual(messages.editImageModalFormErrorMissingFields);
|
|
1064
|
-
expect(validationMessages.at(1).prop('message')).toEqual(messages.editImageModalFormValidImageDescription);
|
|
1065
|
-
|
|
1066
|
-
const statusAlertListItems = shallowWithIntl(statusAlert.prop('dialog')).find('div ul.bullet-list li a');
|
|
1067
990
|
expect(statusAlertListItems).toHaveLength(1);
|
|
1068
|
-
expect(statusAlertListItems.at(0).
|
|
991
|
+
expect(statusAlertListItems.at(0).prop('href')).toEqual('#imageWidth');
|
|
1069
992
|
});
|
|
1070
993
|
|
|
1071
994
|
it('status alert has correct validation message when invalid image dimensions submitted', () => {
|
|
@@ -1340,79 +1263,6 @@ describe('EditImageModal', () => {
|
|
|
1340
1263
|
expect(editImageModal.state('imageDescription')).toEqual(sampleText);
|
|
1341
1264
|
});
|
|
1342
1265
|
|
|
1343
|
-
it('sets this.state.isImageDecorative with value on checkbox onChange', () => {
|
|
1344
|
-
const isImageDecoractiveCheckBox = getImageDescriptionInputCheckBox(editImageModal);
|
|
1345
|
-
|
|
1346
|
-
isImageDecoractiveCheckBox.simulate('change', true);
|
|
1347
|
-
|
|
1348
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(true);
|
|
1349
|
-
|
|
1350
|
-
isImageDecoractiveCheckBox.simulate('change', false);
|
|
1351
|
-
|
|
1352
|
-
expect(editImageModal.state('isImageDecorative')).toEqual(false);
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
it('sends this.state.isImageDecorative as checkbox checked prop to image description checkbox', () => {
|
|
1356
|
-
editImageModal.setState({
|
|
1357
|
-
isImageDecorative: true,
|
|
1358
|
-
});
|
|
1359
|
-
|
|
1360
|
-
expect(getImageDescriptionInputCheckBox(editImageModal).prop('checked')).toEqual(true);
|
|
1361
|
-
|
|
1362
|
-
editImageModal.setState({
|
|
1363
|
-
isImageDecorative: false,
|
|
1364
|
-
});
|
|
1365
|
-
|
|
1366
|
-
expect(getImageDescriptionInputCheckBox(editImageModal).prop('checked')).toEqual(false);
|
|
1367
|
-
});
|
|
1368
|
-
|
|
1369
|
-
it('toggles image description input disabled prop via checkbox', () => {
|
|
1370
|
-
getImageDescriptionInputCheckBox(editImageModal).simulate('change', true);
|
|
1371
|
-
|
|
1372
|
-
editImageModal.update();
|
|
1373
|
-
|
|
1374
|
-
expect(getImageDescriptionInput(editImageModal).prop('disabled')).toEqual(true);
|
|
1375
|
-
|
|
1376
|
-
getImageDescriptionInputCheckBox(editImageModal).simulate('change', false);
|
|
1377
|
-
|
|
1378
|
-
editImageModal.update();
|
|
1379
|
-
|
|
1380
|
-
expect(getImageDescriptionInput(editImageModal).prop('disabled')).toEqual(false);
|
|
1381
|
-
});
|
|
1382
|
-
|
|
1383
|
-
it('returns correct feedback for invalid description (uses initial state)', () => {
|
|
1384
|
-
const feedback = editImageModal.instance().validateImageDescription();
|
|
1385
|
-
|
|
1386
|
-
expect(feedback.isValid).toEqual(false);
|
|
1387
|
-
expect(shallowWithIntl(feedback.validationMessage).prop('message'))
|
|
1388
|
-
.toEqual(messages.editImageModalFormValidImageDescription);
|
|
1389
|
-
expect(shallowWithIntl(feedback.dangerIconDescription).prop('message'))
|
|
1390
|
-
.toEqual(messages.editImageModalFormError);
|
|
1391
|
-
});
|
|
1392
|
-
|
|
1393
|
-
it('returns correct feedback for valid description (with non-empty description)', () => {
|
|
1394
|
-
editImageModal.setState({
|
|
1395
|
-
imageDescription: sampleText,
|
|
1396
|
-
});
|
|
1397
|
-
|
|
1398
|
-
const feedback = editImageModal.instance().validateImageDescription();
|
|
1399
|
-
|
|
1400
|
-
expect(feedback.isValid).toEqual(true);
|
|
1401
|
-
expect(feedback.validationMessage).toBeUndefined();
|
|
1402
|
-
expect(feedback.dangerIconDescription).toBeUndefined();
|
|
1403
|
-
});
|
|
1404
|
-
|
|
1405
|
-
it('returns correct feedback for valid description (with checked checkbox)', () => {
|
|
1406
|
-
editImageModal.setState({
|
|
1407
|
-
isImageDecorative: true,
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
const feedback = editImageModal.instance().validateImageDescription();
|
|
1411
|
-
|
|
1412
|
-
expect(feedback.isValid).toEqual(true);
|
|
1413
|
-
expect(feedback.validationMessage).toBeUndefined();
|
|
1414
|
-
expect(feedback.dangerIconDescription).toBeUndefined();
|
|
1415
|
-
});
|
|
1416
1266
|
});
|
|
1417
1267
|
|
|
1418
1268
|
describe('Image Dimensions Fieldset', () => {
|
|
@@ -1789,10 +1639,11 @@ describe('EditImageModal', () => {
|
|
|
1789
1639
|
expect(dispatchEventSpy.mock.calls[0][0].detail.alt).toEqual(sampleText);
|
|
1790
1640
|
});
|
|
1791
1641
|
|
|
1792
|
-
it('sends empty string in submitForm event
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1642
|
+
it('sends empty string in submitForm event when description is empty', () => {
|
|
1643
|
+
editImageModal.setState({
|
|
1644
|
+
imageDescription: '',
|
|
1645
|
+
imageSource: sampleText,
|
|
1646
|
+
});
|
|
1796
1647
|
|
|
1797
1648
|
getInsertImageButton(editImageModal).simulate('click');
|
|
1798
1649
|
|
|
@@ -48,9 +48,14 @@ const messages = defineMessages({
|
|
|
48
48
|
},
|
|
49
49
|
editImageModalImageDescriptionLabel: {
|
|
50
50
|
id: 'editImageModalImageDescriptionLabel',
|
|
51
|
-
defaultMessage: 'Image Description
|
|
51
|
+
defaultMessage: 'Image Description',
|
|
52
52
|
description: 'Label for the text input box for an image\'s description',
|
|
53
53
|
},
|
|
54
|
+
editImageModalImageDecorativeDescription: {
|
|
55
|
+
id: 'editImageModalImageDecorativeDescription',
|
|
56
|
+
defaultMessage: 'If this image is purely decorative, it does not require alternative text.',
|
|
57
|
+
description: 'Help text shown under the image description when alternative text is optional',
|
|
58
|
+
},
|
|
54
59
|
editImageModalImageDescriptionLegend: {
|
|
55
60
|
id: 'editImageModalImageDescriptionLegend',
|
|
56
61
|
defaultMessage: 'Image Description',
|
|
@@ -66,16 +71,6 @@ const messages = defineMessages({
|
|
|
66
71
|
defaultMessage: 'Height',
|
|
67
72
|
description: 'Label for the text input box for an image\'s height,',
|
|
68
73
|
},
|
|
69
|
-
editImageModalImageIsDecorativeCheckboxDescription: {
|
|
70
|
-
id: 'editImageModalImageIsDecorativeCheckboxDescription',
|
|
71
|
-
defaultMessage: 'This image is a background or other image that does not require alternative text.',
|
|
72
|
-
description: 'Description for a checkbox that explains what it means for an image to be decorative',
|
|
73
|
-
},
|
|
74
|
-
editImageModalImageIsDecorativeCheckboxLabel: {
|
|
75
|
-
id: 'editImageModalImageIsDecorativeCheckboxLabel',
|
|
76
|
-
defaultMessage: 'This image is decorative only',
|
|
77
|
-
description: 'Label for a checkbox that denotes that an image is decorative',
|
|
78
|
-
},
|
|
79
74
|
editImageModalImagePreviewText: {
|
|
80
75
|
id: 'editImageModalImagePreviewText',
|
|
81
76
|
defaultMessage: 'Image Preview',
|
|
@@ -116,11 +111,6 @@ const messages = defineMessages({
|
|
|
116
111
|
defaultMessage: 'Edit Image Settings',
|
|
117
112
|
description: 'Title of the modal used for editing image settings',
|
|
118
113
|
},
|
|
119
|
-
editImageModalImageOrFields: {
|
|
120
|
-
id: 'editImageModalImageOrFields',
|
|
121
|
-
defaultMessage: 'or',
|
|
122
|
-
description: 'Describes two choices,',
|
|
123
|
-
},
|
|
124
114
|
editImageModalNextPageButton: {
|
|
125
115
|
id: 'editImageModalNextPageButton',
|
|
126
116
|
defaultMessage: 'Next',
|