@instructure/ui-options 10.16.1-snapshot-0 → 10.16.1-snapshot-1

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
6
+ ## [10.16.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-1) (2025-04-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-options
9
9
 
@@ -23,7 +23,6 @@ var _Item, _Item2, _Item3, _Item4, _Item5, _Item6, _Item7, _Item8, _Item9, _Item
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, screen, waitFor } from '@testing-library/react';
28
27
  import { vi, expect } from 'vitest';
29
28
  import userEvent from '@testing-library/user-event';
@@ -31,9 +30,10 @@ import '@testing-library/jest-dom';
31
30
  import { IconCheckSolid } from '@instructure/ui-icons';
32
31
  import { Options } from '../../index';
33
32
  import { Item } from '../index';
33
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
34
34
  describe('<Item />', () => {
35
35
  it('should render', async () => {
36
- const _render = render(_Item || (_Item = /*#__PURE__*/React.createElement(Item, null))),
36
+ const _render = render(_Item || (_Item = _jsx(Item, {}))),
37
37
  container = _render.container;
38
38
  const optionItem = container.querySelector('[class$="-optionItem"]');
39
39
  expect(optionItem).toBeInTheDocument();
@@ -41,34 +41,41 @@ describe('<Item />', () => {
41
41
  expect(optionItemContainer).toBeInTheDocument();
42
42
  });
43
43
  it('should not render as a list item by default', async () => {
44
- const _render2 = render(_Item2 || (_Item2 = /*#__PURE__*/React.createElement(Item, null, "Hello World"))),
44
+ const _render2 = render(_Item2 || (_Item2 = _jsx(Item, {
45
+ children: "Hello World"
46
+ }))),
45
47
  container = _render2.container;
46
48
  const item = container.querySelector('[class$="-optionItem"]');
47
49
  expect(item).toBeInTheDocument();
48
50
  expect(item.tagName).not.toBe('LI');
49
51
  });
50
52
  it('should render designated tag if `as` prop is specified', async () => {
51
- const _render3 = render(_Item3 || (_Item3 = /*#__PURE__*/React.createElement(Item, {
52
- as: "li"
53
- }, "Hello World"))),
53
+ const _render3 = render(_Item3 || (_Item3 = _jsx(Item, {
54
+ as: "li",
55
+ children: "Hello World"
56
+ }))),
54
57
  container = _render3.container;
55
58
  const item = container.querySelector('[class$="-optionItem"]');
56
59
  expect(item).toBeInTheDocument();
57
60
  expect(item.tagName).toBe('LI');
58
61
  });
59
62
  it('should render children properly', async () => {
60
- const _render4 = render(_Item4 || (_Item4 = /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement("span", {
61
- id: "customContent"
62
- }, "Hello World")))),
63
+ const _render4 = render(_Item4 || (_Item4 = _jsx(Item, {
64
+ children: _jsx("span", {
65
+ id: "customContent",
66
+ children: "Hello World"
67
+ })
68
+ }))),
63
69
  container = _render4.container;
64
70
  const item = container.querySelector('[class$="-optionItem"]');
65
71
  const customContent = item.querySelector('#customContent');
66
72
  expect(customContent).toHaveTextContent('Hello World');
67
73
  });
68
74
  it('should render role attributes appropriately when given a role', async () => {
69
- const _render5 = render(_Item5 || (_Item5 = /*#__PURE__*/React.createElement(Item, {
70
- role: "option"
71
- }, "Hello World"))),
75
+ const _render5 = render(_Item5 || (_Item5 = _jsx(Item, {
76
+ role: "option",
77
+ children: "Hello World"
78
+ }))),
72
79
  container = _render5.container;
73
80
  const item = container.querySelector('[class$="-optionItem"]');
74
81
  const child = screen.getByRole('option');
@@ -76,11 +83,13 @@ describe('<Item />', () => {
76
83
  expect(child).toBeInTheDocument();
77
84
  });
78
85
  it('should render description properly', async () => {
79
- const _render6 = render(_Item6 || (_Item6 = /*#__PURE__*/React.createElement(Item, {
80
- description: "Some text as description"
81
- }, /*#__PURE__*/React.createElement("span", {
82
- id: "customContent"
83
- }, "Hello World")))),
86
+ const _render6 = render(_Item6 || (_Item6 = _jsx(Item, {
87
+ description: "Some text as description",
88
+ children: _jsx("span", {
89
+ id: "customContent",
90
+ children: "Hello World"
91
+ })
92
+ }))),
84
93
  container = _render6.container;
85
94
  const item = container.querySelector('[class$="-optionItem"]');
86
95
  const customContent = item.querySelector('#customContent');
@@ -89,20 +98,22 @@ describe('<Item />', () => {
89
98
  expect(description).toHaveTextContent('Some text as description');
90
99
  });
91
100
  it('should render role attributes for description', async () => {
92
- render(_Item7 || (_Item7 = /*#__PURE__*/React.createElement(Item, {
101
+ render(_Item7 || (_Item7 = _jsx(Item, {
93
102
  description: "Some text as description",
94
- descriptionRole: "comment"
95
- }, "Hello World")));
103
+ descriptionRole: "comment",
104
+ children: "Hello World"
105
+ })));
96
106
  const description = screen.getByRole('comment');
97
107
  expect(description).toBeInTheDocument();
98
108
  expect(description).toHaveTextContent('Some text as description');
99
109
  });
100
110
  it('should pass props through to label', async () => {
101
- const _render7 = render(_Item8 || (_Item8 = /*#__PURE__*/React.createElement(Item, {
111
+ const _render7 = render(_Item8 || (_Item8 = _jsx(Item, {
102
112
  role: "option",
103
113
  tabIndex: -1,
104
- "data-custom-attr": "true"
105
- }, "Hello World"))),
114
+ "data-custom-attr": "true",
115
+ children: "Hello World"
116
+ }))),
106
117
  container = _render7.container;
107
118
  const optionItem = container.querySelector('[class$="-optionItem"]');
108
119
  const optionItemContainer = optionItem.querySelector('[class$="-optionItem__container"]');
@@ -113,9 +124,10 @@ describe('<Item />', () => {
113
124
  });
114
125
  it('should pass event handlers through to label', async () => {
115
126
  const onClick = vi.fn();
116
- const _render8 = render(/*#__PURE__*/React.createElement(Item, {
117
- onClick: onClick
118
- }, "Hello World")),
127
+ const _render8 = render(_jsx(Item, {
128
+ onClick: onClick,
129
+ children: "Hello World"
130
+ })),
119
131
  container = _render8.container;
120
132
  const optionItem = container.querySelector('[class$="-optionItem"]');
121
133
  const optionItemContainer = container.querySelector('[class$="-optionItem__container"]');
@@ -129,9 +141,10 @@ describe('<Item />', () => {
129
141
  });
130
142
  });
131
143
  it('should render content before label', async () => {
132
- const _render9 = render(_Item9 || (_Item9 = /*#__PURE__*/React.createElement(Item, {
133
- renderBeforeLabel: /*#__PURE__*/React.createElement(IconCheckSolid, null)
134
- }, "Hello World"))),
144
+ const _render9 = render(_Item9 || (_Item9 = _jsx(Item, {
145
+ renderBeforeLabel: _jsx(IconCheckSolid, {}),
146
+ children: "Hello World"
147
+ }))),
135
148
  container = _render9.container;
136
149
  const content = container.querySelector('[class$=-optionItem__content--before]');
137
150
  expect(content).toBeInTheDocument();
@@ -139,9 +152,10 @@ describe('<Item />', () => {
139
152
  expect(icon).toBeInTheDocument();
140
153
  });
141
154
  it('should render content after label', async () => {
142
- const _render10 = render(_Item10 || (_Item10 = /*#__PURE__*/React.createElement(Item, {
143
- renderAfterLabel: /*#__PURE__*/React.createElement(IconCheckSolid, null)
144
- }, "Hello World"))),
155
+ const _render10 = render(_Item10 || (_Item10 = _jsx(Item, {
156
+ renderAfterLabel: _jsx(IconCheckSolid, {}),
157
+ children: "Hello World"
158
+ }))),
145
159
  container = _render10.container;
146
160
  const content = container.querySelector('[class$=-optionItem__content--after]');
147
161
  expect(content).toBeInTheDocument();
@@ -149,10 +163,15 @@ describe('<Item />', () => {
149
163
  expect(icon).toBeInTheDocument();
150
164
  });
151
165
  it('should render nested lists', async () => {
152
- const _render11 = render(_Item11 || (_Item11 = /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(Options, {
153
- as: "ul",
154
- renderLabel: 'Nested list'
155
- }, /*#__PURE__*/React.createElement(Item, null, "Sub item"))))),
166
+ const _render11 = render(_Item11 || (_Item11 = _jsx(Item, {
167
+ children: _jsx(Options, {
168
+ as: "ul",
169
+ renderLabel: 'Nested list',
170
+ children: _jsx(Item, {
171
+ children: "Sub item"
172
+ })
173
+ })
174
+ }))),
156
175
  container = _render11.container;
157
176
  const item = container.querySelector('span[class$="-optionItem"]');
158
177
  expect(item).toBeInTheDocument();
@@ -165,9 +184,10 @@ describe('<Item />', () => {
165
184
  expect(nestedItem).toHaveTextContent('Sub item');
166
185
  });
167
186
  it('should render as link with href prop', async () => {
168
- const _render12 = render(_Item12 || (_Item12 = /*#__PURE__*/React.createElement(Item, {
169
- href: "/helloWorld"
170
- }, "Hello World"))),
187
+ const _render12 = render(_Item12 || (_Item12 = _jsx(Item, {
188
+ href: "/helloWorld",
189
+ children: "Hello World"
190
+ }))),
171
191
  container = _render12.container;
172
192
  const link = container.querySelector('[class$="-optionItem__container"]');
173
193
  expect(link).toBeInTheDocument();
@@ -23,11 +23,10 @@ var _dec, _dec2, _dec3, _class, _Item;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
26
  import { Component } from 'react';
28
27
  import { omitProps, getElementType, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
29
28
  import { testable } from '@instructure/ui-testable';
30
- import { withStyle, jsx } from '@instructure/emotion';
29
+ import { withStyle } from '@instructure/emotion';
31
30
  import generateStyles from './styles';
32
31
  import generateComponentTheme from './theme';
33
32
  import { allowedProps, propTypes } from './props';
@@ -38,6 +37,7 @@ parent: Options
38
37
  id: Options.Item
39
38
  ---
40
39
  **/
40
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
41
41
  let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Item = class Item extends Component {
42
42
  constructor(props) {
43
43
  super(props);
@@ -60,16 +60,17 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
60
60
  as = _this$props3.as,
61
61
  role = _this$props3.role,
62
62
  children = _this$props3.children;
63
- return jsx("span", {
63
+ return _jsx("span", {
64
64
  css: [styles === null || styles === void 0 ? void 0 : styles.content, contentVariant],
65
65
  role: "presentation",
66
- "aria-hidden": "true"
67
- }, callRenderProp(renderLabel, {
68
- variant,
69
- as,
70
- role,
71
- children
72
- }));
66
+ "aria-hidden": "true",
67
+ children: callRenderProp(renderLabel, {
68
+ variant,
69
+ as,
70
+ role,
71
+ children
72
+ })
73
+ });
73
74
  }
74
75
  render() {
75
76
  const _this$props4 = this.props,
@@ -90,7 +91,7 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
90
91
  const childrenContent = callRenderProp(children);
91
92
  const descriptionContent = callRenderProp(description);
92
93
  const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
93
- return jsx(ElementType, {
94
+ return _jsxs(ElementType, {
94
95
  role: voiceoverRoleBugWorkaround ? role : 'none',
95
96
  css: styles === null || styles === void 0 ? void 0 : styles.item,
96
97
  ref: element => {
@@ -99,17 +100,21 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
99
100
  elementRef(element);
100
101
  }
101
102
  },
102
- "aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0
103
- }, jsx(InnerElementType, Object.assign({}, passthroughProps, {
104
- css: styles === null || styles === void 0 ? void 0 : styles.container,
105
- role: href || voiceoverRoleBugWorkaround ? void 0 : role,
106
- href: href,
107
- "aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy
108
- }), childrenContent, descriptionContent && jsx("span", {
109
- css: styles === null || styles === void 0 ? void 0 : styles.description,
110
- role: descriptionRole,
111
- id: this._descriptionId
112
- }, descriptionContent)), renderBeforeLabel && this.renderContent(renderBeforeLabel, styles === null || styles === void 0 ? void 0 : styles.contentBefore), renderAfterLabel && this.renderContent(renderAfterLabel, styles === null || styles === void 0 ? void 0 : styles.contentAfter));
103
+ "aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0,
104
+ children: [_jsxs(InnerElementType, {
105
+ ...passthroughProps,
106
+ css: styles === null || styles === void 0 ? void 0 : styles.container,
107
+ role: href || voiceoverRoleBugWorkaround ? void 0 : role,
108
+ href: href,
109
+ "aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy,
110
+ children: [childrenContent, descriptionContent && _jsx("span", {
111
+ css: styles === null || styles === void 0 ? void 0 : styles.description,
112
+ role: descriptionRole,
113
+ id: this._descriptionId,
114
+ children: descriptionContent
115
+ })]
116
+ }), renderBeforeLabel && this.renderContent(renderBeforeLabel, styles === null || styles === void 0 ? void 0 : styles.contentBefore), renderAfterLabel && this.renderContent(renderAfterLabel, styles === null || styles === void 0 ? void 0 : styles.contentAfter)]
117
+ });
113
118
  }
114
119
  }, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = allowedProps, _Item.propTypes = propTypes, _Item.defaultProps = {
115
120
  as: 'span',
@@ -25,10 +25,9 @@ var _dec, _class, _Separator;
25
25
  * SOFTWARE.
26
26
  */
27
27
 
28
- /** @jsx jsx */
29
28
  import { Component } from 'react';
30
29
  import { getElementType, omitProps } from '@instructure/ui-react-utils';
31
- import { withStyle, jsx } from '@instructure/emotion';
30
+ import { withStyle } from '@instructure/emotion';
32
31
  import generateStyles from './styles';
33
32
  import generateComponentTheme from './theme';
34
33
  import { allowedProps, propTypes } from './props';
@@ -40,6 +39,7 @@ id: Options.Separator
40
39
  ---
41
40
  @module Separator
42
41
  **/
42
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
43
43
  let Separator = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(_class = (_Separator = class Separator extends Component {
44
44
  componentDidMount() {
45
45
  var _this$props$makeStyle, _this$props;
@@ -55,12 +55,14 @@ let Separator = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(
55
55
  styles = _this$props3.styles,
56
56
  rest = _objectWithoutProperties(_this$props3, _excluded);
57
57
  const ElementType = getElementType(Separator, this.props, () => as);
58
- return jsx(ElementType, {
59
- role: "none"
60
- }, jsx("div", Object.assign({}, omitProps(rest, ['styles', 'makeStyles', 'themeOverride']), {
61
- css: styles === null || styles === void 0 ? void 0 : styles.separator,
62
- role: "presentation"
63
- })));
58
+ return _jsx(ElementType, {
59
+ role: "none",
60
+ children: _jsx("div", {
61
+ ...omitProps(rest, ['styles', 'makeStyles', 'themeOverride']),
62
+ css: styles === null || styles === void 0 ? void 0 : styles.separator,
63
+ role: "presentation"
64
+ })
65
+ });
64
66
  }
65
67
  }, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = allowedProps, _Separator.propTypes = propTypes, _Separator.defaultProps = {
66
68
  as: 'span'
@@ -22,53 +22,52 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React from 'react';
26
25
  import { IconCheckSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
27
26
  import { Options } from '../index';
27
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
28
28
  export default {
29
29
  maxExamplesPerPage: 50,
30
30
  propValues: {
31
- children: [[/*#__PURE__*/React.createElement(Options.Item, {
32
- key: "option-1"
33
- }, "Option one"), /*#__PURE__*/React.createElement(Options.Item, {
34
- key: "option-2",
35
- variant: "highlighted"
36
- }, "Option two"), /*#__PURE__*/React.createElement(Options.Item, {
37
- key: "option-3",
38
- variant: "selected"
39
- }, "Option three"), /*#__PURE__*/React.createElement(Options.Item, {
40
- key: "option-4",
41
- variant: "disabled"
42
- }, "Option four")], [/*#__PURE__*/React.createElement(Options.Item, {
43
- key: "option-1",
31
+ children: [[_jsx(Options.Item, {
32
+ children: "Option one"
33
+ }, "option-1"), _jsx(Options.Item, {
44
34
  variant: "highlighted",
45
- renderAfterLabel: IconArrowOpenEndSolid
46
- }, "Flyout menu option"), /*#__PURE__*/React.createElement(Options.Item, {
47
- key: "option-2"
48
- }, "Option one"), /*#__PURE__*/React.createElement(Options.Separator, {
49
- key: "sep-1"
50
- }), /*#__PURE__*/React.createElement(Options, {
51
- key: "sub-list",
52
- renderLabel: 'Sub list'
53
- }, /*#__PURE__*/React.createElement(Options.Item, {
54
- variant: "selected"
55
- }, "Sub option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Sub option two")), /*#__PURE__*/React.createElement(Options.Separator, {
56
- key: "sep-2"
57
- }), /*#__PURE__*/React.createElement(Options, {
58
- key: "icon-list",
59
- renderLabel: 'Icon List'
60
- }, /*#__PURE__*/React.createElement(Options.Item, {
61
- renderBeforeLabel: IconCheckSolid
62
- }, "Icon option one"), /*#__PURE__*/React.createElement(Options.Item, {
63
- renderBeforeLabel: /*#__PURE__*/React.createElement(IconCheckSolid, {
64
- style: {
65
- opacity: 0
66
- }
67
- })
68
- }, "Icon option two")), /*#__PURE__*/React.createElement(Options.Separator, {
69
- key: "sep-3"
70
- }), /*#__PURE__*/React.createElement(Options.Item, {
71
- key: "option-3"
72
- }, "Option two")]]
35
+ children: "Option two"
36
+ }, "option-2"), _jsx(Options.Item, {
37
+ variant: "selected",
38
+ children: "Option three"
39
+ }, "option-3"), _jsx(Options.Item, {
40
+ variant: "disabled",
41
+ children: "Option four"
42
+ }, "option-4")], [_jsx(Options.Item, {
43
+ variant: "highlighted",
44
+ renderAfterLabel: IconArrowOpenEndSolid,
45
+ children: "Flyout menu option"
46
+ }, "option-1"), _jsx(Options.Item, {
47
+ children: "Option one"
48
+ }, "option-2"), _jsx(Options.Separator, {}, "sep-1"), _jsxs(Options, {
49
+ renderLabel: 'Sub list',
50
+ children: [_jsx(Options.Item, {
51
+ variant: "selected",
52
+ children: "Sub option one"
53
+ }), _jsx(Options.Item, {
54
+ children: "Sub option two"
55
+ })]
56
+ }, "sub-list"), _jsx(Options.Separator, {}, "sep-2"), _jsxs(Options, {
57
+ renderLabel: 'Icon List',
58
+ children: [_jsx(Options.Item, {
59
+ renderBeforeLabel: IconCheckSolid,
60
+ children: "Icon option one"
61
+ }), _jsx(Options.Item, {
62
+ renderBeforeLabel: _jsx(IconCheckSolid, {
63
+ style: {
64
+ opacity: 0
65
+ }
66
+ }),
67
+ children: "Icon option two"
68
+ })]
69
+ }, "icon-list"), _jsx(Options.Separator, {}, "sep-3"), _jsx(Options.Item, {
70
+ children: "Option two"
71
+ }, "option-3")]]
73
72
  }
74
73
  };
@@ -23,7 +23,6 @@ var _Options, _Options2, _Options$Item, _Options$Item2, _Options3, _Options4, _O
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, screen } from '@testing-library/react';
28
27
  import { vi, expect } from 'vitest';
29
28
  import { runAxeCheck } from '@instructure/ui-axe-check';
@@ -33,38 +32,60 @@ import { generateA11yTests } from '@instructure/ui-scripts/lib/test/generateA11y
33
32
  import '@testing-library/jest-dom';
34
33
  import { Options } from '../index';
35
34
  import OptionsExamples from '../__examples__/Options.examples';
35
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
36
36
  describe('<Options />', () => {
37
37
  it('should render', async () => {
38
- const _render = render(_Options || (_Options = /*#__PURE__*/React.createElement(Options, null))),
38
+ const _render = render(_Options || (_Options = _jsx(Options, {}))),
39
39
  container = _render.container;
40
- const options = container.querySelector('div[class$="-options"]');
40
+ const options = container.querySelector('div[class*="-options"]');
41
41
  expect(options).toBeInTheDocument();
42
42
  });
43
43
  it('should render items', async () => {
44
- render(_Options2 || (_Options2 = /*#__PURE__*/React.createElement(Options, null, /*#__PURE__*/React.createElement(Options.Item, null, "Option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Option two"))));
44
+ render(_Options2 || (_Options2 = _jsxs(Options, {
45
+ children: [_jsx(Options.Item, {
46
+ children: "Option one"
47
+ }), _jsx(Options.Item, {
48
+ children: "Option two"
49
+ })]
50
+ })));
45
51
  const items = screen.getAllByRole('listitem');
46
52
  expect(items.length).toBe(2);
47
53
  });
48
54
  it('should provide elementRef', async () => {
49
55
  const elementRef = vi.fn();
50
- render(/*#__PURE__*/React.createElement(Options, {
56
+ render(_jsxs(Options, {
51
57
  elementRef: elementRef,
52
- as: "ul"
53
- }, _Options$Item || (_Options$Item = /*#__PURE__*/React.createElement(Options.Item, null, "Option one")), _Options$Item2 || (_Options$Item2 = /*#__PURE__*/React.createElement(Options.Item, null, "Option two"))));
58
+ as: "ul",
59
+ children: [_Options$Item || (_Options$Item = _jsx(Options.Item, {
60
+ children: "Option one"
61
+ })), _Options$Item2 || (_Options$Item2 = _jsx(Options.Item, {
62
+ children: "Option two"
63
+ }))]
64
+ }));
54
65
  const optionList = screen.getByRole('list');
55
66
  expect(elementRef).toHaveBeenCalledWith(optionList);
56
67
  });
57
68
  it('should render designated tag if `as` prop is specified', async () => {
58
- render(_Options3 || (_Options3 = /*#__PURE__*/React.createElement(Options, {
59
- as: "ol"
60
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Option two"))));
69
+ render(_Options3 || (_Options3 = _jsxs(Options, {
70
+ as: "ol",
71
+ children: [_jsx(Options.Item, {
72
+ children: "Option one"
73
+ }), _jsx(Options.Item, {
74
+ children: "Option two"
75
+ })]
76
+ })));
61
77
  const optionList = screen.getByRole('list');
62
78
  expect(optionList.tagName).toBe('OL');
63
79
  });
64
80
  it('should render children as listitems when appropriate', async () => {
65
- const _render2 = render(_Options4 || (_Options4 = /*#__PURE__*/React.createElement(Options, {
66
- as: "ul"
67
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Option two")))),
81
+ const _render2 = render(_Options4 || (_Options4 = _jsxs(Options, {
82
+ as: "ul",
83
+ children: [_jsx(Options.Item, {
84
+ children: "Option one"
85
+ }), _jsx(Options.Item, {
86
+ children: "Option two"
87
+ })]
88
+ }))),
68
89
  container = _render2.container;
69
90
  const list = container.querySelector('ul');
70
91
  const items = container.querySelectorAll('li');
@@ -72,44 +93,64 @@ describe('<Options />', () => {
72
93
  expect(items.length).toBe(2);
73
94
  });
74
95
  it('should pass props through to list', async () => {
75
- const _render3 = render(_Options5 || (_Options5 = /*#__PURE__*/React.createElement(Options, {
96
+ const _render3 = render(_Options5 || (_Options5 = _jsxs(Options, {
76
97
  as: "ul",
77
98
  role: "listbox",
78
- "data-custom-attr": "true"
79
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Option two")))),
99
+ "data-custom-attr": "true",
100
+ children: [_jsx(Options.Item, {
101
+ children: "Option one"
102
+ }), _jsx(Options.Item, {
103
+ children: "Option two"
104
+ })]
105
+ }))),
80
106
  container = _render3.container;
81
- const options = container.querySelector('[class$="-options__list"]');
107
+ const options = container.querySelector('[class*="-options__list"]');
82
108
  expect(options).toHaveRole('listbox');
83
109
  expect(options).toHaveAttribute('data-custom-attr', 'true');
84
110
  });
85
111
  it('should render root with appropriate role', async () => {
86
- const _render4 = render(_Options6 || (_Options6 = /*#__PURE__*/React.createElement(Options, {
87
- role: "listbox"
88
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Option one"), /*#__PURE__*/React.createElement(Options.Item, null, "Option two")))),
112
+ const _render4 = render(_Options6 || (_Options6 = _jsxs(Options, {
113
+ role: "listbox",
114
+ children: [_jsx(Options.Item, {
115
+ children: "Option one"
116
+ }), _jsx(Options.Item, {
117
+ children: "Option two"
118
+ })]
119
+ }))),
89
120
  container = _render4.container;
90
- const options = container.querySelector('div[class$="-options"]');
121
+ const options = container.querySelector('div[class*="-options"]');
91
122
  expect(options).toHaveAttribute('role', 'presentation');
92
123
  });
93
124
  it('should allow null children', async () => {
94
- render(_Options7 || (_Options7 = /*#__PURE__*/React.createElement(Options, null)));
125
+ render(_Options7 || (_Options7 = _jsx(Options, {})));
95
126
  const options = screen.getByRole('list');
96
127
  expect(options).toBeInTheDocument();
97
128
  });
98
129
  it('should render nested options properly', async () => {
99
- const _render5 = render(_Options8 || (_Options8 = /*#__PURE__*/React.createElement(Options, {
100
- "data-testId": "outer-list"
101
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Option one "), /*#__PURE__*/React.createElement(Options.Item, null, "Option two "), /*#__PURE__*/React.createElement(Options, {
102
- renderLabel: 'Nested list',
103
- "data-testId": "nested-list"
104
- }, /*#__PURE__*/React.createElement(Options.Item, null, "Nested option one "), /*#__PURE__*/React.createElement(Options.Item, null, "Nested option two "))))),
130
+ const _render5 = render(_Options8 || (_Options8 = _jsxs(Options, {
131
+ "data-testId": "outer-list",
132
+ children: [_jsx(Options.Item, {
133
+ children: "Option one "
134
+ }), _jsx(Options.Item, {
135
+ children: "Option two "
136
+ }), _jsxs(Options, {
137
+ renderLabel: 'Nested list',
138
+ "data-testId": "nested-list",
139
+ children: [_jsx(Options.Item, {
140
+ children: "Nested option one "
141
+ }), _jsx(Options.Item, {
142
+ children: "Nested option two "
143
+ })]
144
+ })]
145
+ }))),
105
146
  container = _render5.container;
106
- const allLists = container.querySelectorAll('[class$="-options__list"]');
147
+ const allLists = container.querySelectorAll('[class*="-options__list"]');
107
148
  const allItems = container.querySelectorAll('[class$="-optionItem"]');
108
149
  expect(allLists.length).toBe(2);
109
150
  expect(allItems.length).toBe(5);
110
151
  const outerList = screen.getByTestId('outer-list');
111
152
  expect(outerList).toHaveTextContent('Option one Option two');
112
- const nestedLabel = outerList.querySelector('[class$=-options__label]');
153
+ const nestedLabel = outerList.querySelector('[class*=-options__label]');
113
154
  expect(nestedLabel).toBeInTheDocument();
114
155
  expect(nestedLabel).toHaveTextContent('Nested list');
115
156
  const nestedList = screen.getByTestId('nested-list');
@@ -138,9 +179,14 @@ describe('<Options />', () => {
138
179
  });
139
180
  describe('for a11y', () => {
140
181
  it('should be accessible with links', async () => {
141
- const _render7 = render(_Options9 || (_Options9 = /*#__PURE__*/React.createElement(Options, null, /*#__PURE__*/React.createElement(Options.Item, null, "Option"), /*#__PURE__*/React.createElement(Options.Item, {
142
- href: "/"
143
- }, "Option link")))),
182
+ const _render7 = render(_Options9 || (_Options9 = _jsxs(Options, {
183
+ children: [_jsx(Options.Item, {
184
+ children: "Option"
185
+ }), _jsx(Options.Item, {
186
+ href: "/",
187
+ children: "Option link"
188
+ })]
189
+ }))),
144
190
  container = _render7.container;
145
191
 
146
192
  // axe-check is more strict now, and expects "list" role to have "listitem" children, but we use "role='none'" children. After discussing it with the A11y team, we agreed to ignore this error because the screen readers can read the component perfectly.