@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-form-engine-lib",
3
- "version": "3.1.5-pre.1884",
3
+ "version": "3.1.5-pre.1886",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -27,34 +27,28 @@ const TooltipWrapper: React.FC<{ field: FormField; children: React.ReactNode }>
27
27
  );
28
28
  };
29
29
 
30
- const FieldLabelContent: React.FC<FieldLabelProps> = ({ field, customLabel }) => {
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
- <div className={styles.questionLabel} data-testid={`${field.id}-label`}>
36
- <span>{labelText}</span>
37
- {field.isRequired && (
38
- <span title={t('required', 'Required')} className={styles.required}>
39
- *
40
- </span>
41
- )}
42
- {hasTooltip && (
43
- <Information
44
- size={20}
45
- aria-hidden="true"
46
- className={styles.tooltipIcon}
47
- data-testid={`${field.id}-information-icon`}
48
- />
49
- )}
50
- </div>
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
  };
@@ -253,7 +253,7 @@ describe('Form engine component', () => {
253
253
  renderForm(null, sampleFieldsForm);
254
254
  });
255
255
 
256
- screen.findByRole('textbox', { name: /text question/i });
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.getAllByRole('textbox', { name: /Text question/i });
362
+ const inputFields = screen.getAllByLabelText(/Text question/i);
363
363
  expect(inputFields).toHaveLength(2);
364
364
 
365
365
  inputFields.forEach((inputField) => {