@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.
- package/dist/Button/_variables.scss +3 -1
- package/dist/Button/index.scss +2 -2
- package/dist/DataTable/index.js +1 -1
- package/dist/DataTable/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +9 -4
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/paragon.css +1 -1
- package/package.json +1 -1
- package/scss/core/_variables.scss +1 -1
- package/src/Button/README.md +141 -85
- package/src/Button/_variables.scss +3 -1
- package/src/Button/index.scss +2 -2
- package/src/DataTable/README.md +3 -3
- package/src/DataTable/index.jsx +1 -1
- package/src/DataTable/tablefilters.mdx +3 -3
- package/src/Form/FormAutosuggest.jsx +11 -5
- package/src/Form/form-autosuggest.mdx +80 -72
- package/src/Form/tests/FormAutosuggest.test.jsx +21 -0
|
@@ -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', () => {
|