@openedx/paragon 21.11.2 → 21.11.4

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.
@@ -6,6 +6,8 @@ import userEvent from '@testing-library/user-event';
6
6
  import { IntlProvider } from 'react-intl';
7
7
  import FormAutosuggest from '../FormAutosuggest';
8
8
  import FormAutosuggestOption from '../FormAutosuggestOption';
9
+ import FormGroup from '../FormGroup';
10
+ import FormLabel from '../FormLabel';
9
11
 
10
12
  function FormAutosuggestWrapper(props) {
11
13
  return (
@@ -31,6 +33,19 @@ function FormAutosuggestTestComponent(props) {
31
33
  );
32
34
  }
33
35
 
36
+ function FormAutosuggestLabelTestComponent() {
37
+ return (
38
+ <FormGroup>
39
+ <FormLabel data-testid="autosuggest-label">
40
+ <h3>Label</h3>
41
+ </FormLabel>
42
+ <FormAutosuggestWrapper>
43
+ <FormAutosuggestOption>Option</FormAutosuggestOption>
44
+ </FormAutosuggestWrapper>
45
+ </FormGroup>
46
+ );
47
+ }
48
+
34
49
  FormAutosuggestTestComponent.defaultProps = {
35
50
  onSelected: jest.fn(),
36
51
  onClick: jest.fn(),
@@ -112,6 +127,12 @@ describe('render behavior', () => {
112
127
 
113
128
  expect(getByText('3 options found')).toBeInTheDocument();
114
129
  });
130
+
131
+ it('associates labels with the input textbox', () => {
132
+ const { getByTestId } = render(<FormAutosuggestLabelTestComponent />);
133
+
134
+ expect(getByTestId('autosuggest-label').getAttribute('for')).toEqual(getByTestId('autosuggest-textbox-input').getAttribute('id'));
135
+ });
115
136
  });
116
137
 
117
138
  describe('controlled behavior', () => {