@openmrs/esm-form-engine-lib 3.1.5-pre.1884 → 3.1.5-pre.1886
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/package.json
CHANGED
@@ -27,34 +27,28 @@ const TooltipWrapper: React.FC<{ field: FormField; children: React.ReactNode }>
|
|
27
27
|
);
|
28
28
|
};
|
29
29
|
|
30
|
-
const
|
30
|
+
const FieldLabel: React.FC<FieldLabelProps> = ({ field, customLabel }) => {
|
31
31
|
const { t } = useTranslation();
|
32
32
|
const hasTooltip = Boolean(field.questionInfo);
|
33
33
|
const labelText = customLabel || t(field.label);
|
34
34
|
return (
|
35
|
-
<
|
36
|
-
<
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
};
|
53
|
-
|
54
|
-
const FieldLabel: React.FC<FieldLabelProps> = (props) => {
|
55
|
-
return (
|
56
|
-
<TooltipWrapper field={props.field}>
|
57
|
-
<FieldLabelContent {...props} />
|
35
|
+
<TooltipWrapper field={field}>
|
36
|
+
<div className={styles.questionLabel} data-testid={`${field.id}-label`}>
|
37
|
+
<span>{labelText}</span>
|
38
|
+
{field.isRequired && (
|
39
|
+
<span title={t('required', 'Required')} className={styles.required}>
|
40
|
+
*
|
41
|
+
</span>
|
42
|
+
)}
|
43
|
+
{hasTooltip && (
|
44
|
+
<Information
|
45
|
+
size={20}
|
46
|
+
aria-hidden="true"
|
47
|
+
className={styles.tooltipIcon}
|
48
|
+
data-testid={`${field.id}-information-icon`}
|
49
|
+
/>
|
50
|
+
)}
|
51
|
+
</div>
|
58
52
|
</TooltipWrapper>
|
59
53
|
);
|
60
54
|
};
|
package/src/form-engine.test.tsx
CHANGED
@@ -253,7 +253,7 @@ describe('Form engine component', () => {
|
|
253
253
|
renderForm(null, sampleFieldsForm);
|
254
254
|
});
|
255
255
|
|
256
|
-
screen.
|
256
|
+
screen.findByLabelText(/text question/i);
|
257
257
|
|
258
258
|
const textFieldTooltip = screen.getByTestId('id_text-label');
|
259
259
|
expect(textFieldTooltip).toBeInTheDocument();
|
@@ -359,7 +359,7 @@ describe('Form engine component', () => {
|
|
359
359
|
const requiredAsterisks = screen.getAllByText('*');
|
360
360
|
expect(requiredAsterisks).toHaveLength(2);
|
361
361
|
|
362
|
-
const inputFields = screen.
|
362
|
+
const inputFields = screen.getAllByLabelText(/Text question/i);
|
363
363
|
expect(inputFields).toHaveLength(2);
|
364
364
|
|
365
365
|
inputFields.forEach((inputField) => {
|