react-aria-menubutton 7.0.2 → 8.0.0

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.
Files changed (43) hide show
  1. package/README.md +140 -122
  2. package/dist/index.d.ts +59 -0
  3. package/dist/react-aria-menubutton.cjs.js +1 -0
  4. package/dist/react-aria-menubutton.es.js +566 -0
  5. package/dist/react-aria-menubutton.umd.js +1 -0
  6. package/package.json +62 -57
  7. package/CHANGELOG.md +0 -173
  8. package/CODE_OF_CONDUCT.md +0 -22
  9. package/dist/Button.js +0 -140
  10. package/dist/ManagerContext.js +0 -7
  11. package/dist/Menu.js +0 -131
  12. package/dist/MenuItem.js +0 -96
  13. package/dist/Wrapper.js +0 -66
  14. package/dist/createManager.js +0 -154
  15. package/dist/externalStateControl.js +0 -32
  16. package/dist/index.js +0 -12
  17. package/dist/propTypes.js +0 -7
  18. package/dist/specialAssign.js +0 -11
  19. package/src/Button.js +0 -129
  20. package/src/ManagerContext.js +0 -5
  21. package/src/Menu.js +0 -118
  22. package/src/MenuItem.js +0 -84
  23. package/src/Wrapper.js +0 -54
  24. package/src/__tests__/Button.test.js +0 -169
  25. package/src/__tests__/Menu.test.js +0 -130
  26. package/src/__tests__/MenuItem.test.js +0 -106
  27. package/src/__tests__/__snapshots__/Button.test.js.snap +0 -41
  28. package/src/__tests__/__snapshots__/Menu.test.js.snap +0 -54
  29. package/src/__tests__/__snapshots__/MenuItem.test.js.snap +0 -37
  30. package/src/__tests__/createManager.test.js +0 -190
  31. package/src/__tests__/helpers/MockWrapper.js +0 -24
  32. package/src/__tests__/helpers/createMockKeyEvent.js +0 -7
  33. package/src/__tests__/helpers/createMockManager.js +0 -22
  34. package/src/__tests__/helpers/jest-setup.js +0 -5
  35. package/src/__tests__/helpers/raf.js +0 -3
  36. package/src/createManager.js +0 -162
  37. package/src/externalStateControl.js +0 -31
  38. package/src/index.js +0 -10
  39. package/src/propTypes.js +0 -8
  40. package/src/specialAssign.js +0 -9
  41. package/umd/ReactAriaMenuButton.js +0 -1
  42. package/webpack-demo.config.js +0 -14
  43. package/webpack-umd.config.js +0 -35
package/src/MenuItem.js DELETED
@@ -1,84 +0,0 @@
1
- const React = require('react');
2
- const PropTypes = require('prop-types');
3
- const ManagerContext = require('./ManagerContext');
4
- const { refType } = require("./propTypes");
5
- const specialAssign = require('./specialAssign');
6
-
7
- const checkedProps = {
8
- ambManager: PropTypes.object.isRequired,
9
- children: PropTypes.node.isRequired,
10
- forwardedRef: refType,
11
- tag: PropTypes.string,
12
- text: PropTypes.string,
13
- value: PropTypes.any
14
- };
15
-
16
- class AriaMenuButtonMenuItem extends React.Component {
17
- static propTypes = checkedProps;
18
- static defaultProps = { tag: 'div' };
19
-
20
- ref = React.createRef();
21
-
22
- componentDidMount() {
23
- this.props.ambManager.addItem({
24
- node: this.ref.current,
25
- text: this.props.text
26
- });
27
- }
28
-
29
- handleKeyDown = event => {
30
- if (event.key !== 'Enter' && event.key !== ' ') return;
31
- if (this.props.tag === 'a' && this.props.href) return;
32
- event.preventDefault();
33
- this.selectItem(event);
34
- };
35
-
36
- selectItem = event => {
37
- // If there's no value, we'll send the child
38
- const value = typeof this.props.value !== 'undefined'
39
- ? this.props.value
40
- : this.props.children;
41
- this.props.ambManager.handleSelection(value, event);
42
- };
43
-
44
- setRef = instance => {
45
- this.ref.current = instance;
46
- if (typeof this.props.forwardedRef === "function") {
47
- this.props.forwardedRef(instance);
48
- } else if (this.props.forwardedRef) {
49
- this.props.forwardedRef.current = instance;
50
- }
51
- };
52
-
53
- render() {
54
- const menuItemProps = {
55
- onClick: this.selectItem,
56
- onKeyDown: this.handleKeyDown,
57
- role: 'menuitem',
58
- tabIndex: '-1',
59
- ref: this.setRef
60
- };
61
-
62
- specialAssign(menuItemProps, this.props, checkedProps);
63
-
64
- return React.createElement(
65
- this.props.tag,
66
- menuItemProps,
67
- this.props.children
68
- );
69
- }
70
- }
71
-
72
- module.exports = React.forwardRef((props, ref) => React.createElement(
73
- ManagerContext.Consumer,
74
- null,
75
- (ambManager) => {
76
- const buttonProps = { ambManager, forwardedRef: ref };
77
- specialAssign(buttonProps, props, {
78
- ambManager: checkedProps.ambManager,
79
- children: checkedProps.children,
80
- forwardedRef: checkedProps.forwardedRef
81
- });
82
- return React.createElement(AriaMenuButtonMenuItem, buttonProps, props.children);
83
- }
84
- ));
package/src/Wrapper.js DELETED
@@ -1,54 +0,0 @@
1
- const React = require('react');
2
- const PropTypes = require('prop-types');
3
- const createManager = require('./createManager');
4
- const ManagerContext = require('./ManagerContext');
5
- const { refType } = require("./propTypes");
6
- const specialAssign = require('./specialAssign');
7
-
8
- const checkedProps = {
9
- children: PropTypes.node.isRequired,
10
- forwardedRef: refType,
11
- onMenuToggle: PropTypes.func,
12
- onSelection: PropTypes.func,
13
- closeOnSelection: PropTypes.bool,
14
- closeOnBlur: PropTypes.bool,
15
- tag: PropTypes.string
16
- };
17
-
18
- class AriaMenuButtonWrapper extends React.Component {
19
- static propTypes = checkedProps;
20
- static defaultProps = { tag: 'div' };
21
-
22
- constructor(props) {
23
- super(props);
24
- this.manager = createManager({
25
- onMenuToggle: this.props.onMenuToggle,
26
- onSelection: this.props.onSelection,
27
- closeOnSelection: this.props.closeOnSelection,
28
- closeOnBlur: this.props.closeOnBlur,
29
- id: this.props.id
30
- });
31
- }
32
-
33
- render() {
34
- const wrapperProps = {};
35
- specialAssign(wrapperProps, this.props, checkedProps);
36
-
37
- return React.createElement(
38
- ManagerContext.Provider,
39
- { value: this.manager },
40
- React.createElement(
41
- this.props.tag,
42
- wrapperProps,
43
- this.props.children,
44
- ),
45
- );
46
- }
47
- }
48
-
49
- module.exports = React.forwardRef((props, ref) => {
50
- const wrapperProps = { forwardedRef: ref };
51
- specialAssign(wrapperProps, props, { children: checkedProps.children, forwardedRef: checkedProps.forwardedRef });
52
- specialAssign(wrapperProps, { forwardedRef: ref });
53
- return React.createElement(AriaMenuButtonWrapper, wrapperProps, props.children);
54
- });
@@ -1,169 +0,0 @@
1
- const React = require('react');
2
- const ReactDOMServer = require('react-dom/server');
3
- const shallow = require('enzyme').shallow;
4
- const shallowToJson = require('enzyme-to-json').shallowToJson;
5
- const Button = require('../Button');
6
- const ManagerContext = require('../ManagerContext');
7
- const MockWrapper = require('./helpers/MockWrapper');
8
- const createMockKeyEvent = require('./helpers/createMockKeyEvent');
9
- const createMockManager = require('./helpers/createMockManager');
10
- const createManager = require('../createManager');
11
-
12
- const el = React.createElement;
13
-
14
- describe('<Button>', function() {
15
- let shallowOptions;
16
- let ambManager;
17
- let downEvent;
18
- let enterEvent;
19
- let spaceEvent;
20
- let escapeEvent;
21
- let fEvent;
22
-
23
- beforeEach(function() {
24
- ambManager = createMockManager();
25
- shallowOptions = {
26
- wrappingComponent: ManagerContext.Provider,
27
- wrappingComponentProps: { value: ambManager },
28
- };
29
- downEvent = createMockKeyEvent('ArrowDown');
30
- enterEvent = createMockKeyEvent('Enter');
31
- spaceEvent = createMockKeyEvent(' ');
32
- escapeEvent = createMockKeyEvent('Escape');
33
- fEvent = createMockKeyEvent(null, 70);
34
- });
35
-
36
- test('DOM with only required props and text child', function() {
37
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
38
- expect(shallowToJson(wrapper)).toMatchSnapshot();
39
- });
40
-
41
- test('no onBlur prop when closeOnBlur is false', function() {
42
- const manager = createManager({ closeOnBlur: false });
43
- const shallowOptions = {
44
- wrappingComponent: ManagerContext.Provider,
45
- wrappingComponentProps: { value: manager }
46
- };
47
- const wrapper = shallow(el(Button, null, ''), shallowOptions).dive().dive();
48
- expect(shallowToJson(wrapper).props).not.toHaveProperty('onBlur');
49
- });
50
-
51
- test('DOM with all possible props and element child', function() {
52
- const button = el(
53
- Button,
54
- {
55
- id: 'foo',
56
- className: 'bar',
57
- style: { top: 2 },
58
- tag: 'button',
59
- disabled: true,
60
- 'data-something-something': 'seven' // arbitrary prop
61
- },
62
- el('span', null, 'hooha')
63
- );
64
- const wrapper = shallow(button, shallowOptions).dive().dive();
65
- expect(shallowToJson(wrapper)).toMatchSnapshot();
66
- });
67
-
68
- test('click', function() {
69
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
70
- wrapper.simulate('click');
71
-
72
- expect(ambManager.toggleMenu).toHaveBeenCalledTimes(1);
73
- });
74
-
75
- test('click when disabled', function() {
76
- const wrapper = shallow(
77
- el(Button, { disabled: true }, 'foo'),
78
- shallowOptions
79
- ).dive().dive();
80
- wrapper.simulate('click');
81
-
82
- expect(ambManager.toggleMenu).not.toHaveBeenCalled();
83
- });
84
-
85
- test('element has disabled attribute when disabled property is set to true', function() {
86
- const wrapper = shallow(
87
- el(Button, { disabled: true, tag: 'button' }, 'foo'),
88
- shallowOptions
89
- ).dive().dive();
90
-
91
- expect(wrapper.props().disabled).toBeTruthy();
92
- });
93
-
94
- test('down arrow when closed', function() {
95
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
96
- wrapper.simulate('keyDown', downEvent);
97
-
98
- expect(downEvent.preventDefault).toHaveBeenCalledTimes(1);
99
- expect(ambManager.openMenu).toHaveBeenCalledTimes(1);
100
- expect(ambManager.openMenu).toHaveBeenCalledWith();
101
- });
102
-
103
- test('down arrow when open', function() {
104
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
105
- ambManager.isOpen = true;
106
- wrapper.simulate('keyDown', downEvent);
107
-
108
- expect(downEvent.preventDefault).toHaveBeenCalledTimes(1);
109
- expect(ambManager.openMenu).not.toHaveBeenCalled();
110
- });
111
-
112
- test('enter key', function() {
113
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
114
- wrapper.simulate('keyDown', enterEvent);
115
-
116
- expect(enterEvent.preventDefault).toHaveBeenCalledTimes(1);
117
- expect(ambManager.toggleMenu).toHaveBeenCalledTimes(1);
118
- });
119
-
120
- test('space key', function() {
121
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
122
- wrapper.simulate('keyDown', spaceEvent);
123
-
124
- expect(spaceEvent.preventDefault).toHaveBeenCalledTimes(1);
125
- expect(ambManager.toggleMenu).toHaveBeenCalledTimes(1);
126
- });
127
-
128
- test('escape key', function() {
129
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
130
- wrapper.simulate('keyDown', escapeEvent);
131
-
132
- expect(ambManager.handleMenuKey).toHaveBeenCalledTimes(1);
133
- expect(ambManager.handleMenuKey.mock.calls[0][0].key).toBe('Escape');
134
- });
135
-
136
- test('f key', function() {
137
- const wrapper = shallow(el(Button, null, 'foo'), shallowOptions).dive().dive();
138
- wrapper.simulate('keyDown', fEvent);
139
-
140
- expect(ambManager.handleButtonNonArrowKey).toHaveBeenCalledTimes(1);
141
- expect(ambManager.handleButtonNonArrowKey.mock.calls[0][0].keyCode).toBe(
142
- 70
143
- );
144
- });
145
-
146
- test('enter key when disabled', function() {
147
- const wrapper = shallow(
148
- el(Button, { disabled: true }, 'foo'),
149
- shallowOptions
150
- ).dive().dive();
151
- wrapper.simulate('keyDown', enterEvent);
152
-
153
- expect(enterEvent.preventDefault).not.toHaveBeenCalled();
154
- expect(ambManager.toggleMenu).not.toHaveBeenCalled();
155
- });
156
- });
157
-
158
- describe('<Button> rendered via renderToString', function() {
159
- test('does not throw', function() {
160
- const output = ReactDOMServer.renderToString(
161
- el(
162
- MockWrapper,
163
- { mockManager: createMockManager() },
164
- el(Button, null, 'foo')
165
- )
166
- );
167
- expect(output).toMatchSnapshot();
168
- });
169
- });
@@ -1,130 +0,0 @@
1
- const React = require('react');
2
- const ReactDOMServer = require('react-dom/server');
3
- const shallow = require('enzyme').shallow;
4
- const mount = require('enzyme').mount;
5
- const shallowToJson = require('enzyme-to-json').shallowToJson;
6
- const ManagerContext = require('../ManagerContext');
7
- const Menu = require('../Menu');
8
- const MockWrapper = require('./helpers/MockWrapper');
9
- const createMockManager = require('./helpers/createMockManager');
10
- const createManager = require('../createManager');
11
-
12
- const el = React.createElement;
13
-
14
- describe('<Menu>', function() {
15
- let shallowOptions;
16
- let ambManager;
17
-
18
- beforeEach(function() {
19
- ambManager = createMockManager();
20
- shallowOptions = {
21
- wrappingComponent: ManagerContext.Provider,
22
- wrappingComponentProps: { value: ambManager }
23
- };
24
- });
25
-
26
- test('closed Menu DOM with only required props and element child', function() {
27
- const menuEl = el(Menu, null, el('div', null, 'foo'));
28
- const wrapper = shallow(menuEl, shallowOptions).dive().dive();
29
- expect(shallowToJson(wrapper)).toMatchSnapshot();
30
- });
31
-
32
- test('no onBlur prop when closeOnBlur is false', function() {
33
- const manager = createManager({ closeOnBlur: false });
34
- manager.isOpen = true;
35
- const shallowOptions = {
36
- wrappingComponent: ManagerContext.Provider,
37
- wrappingComponentProps: { value: manager }
38
- };
39
- const menuEl = el(Menu, null, el('div', null, 'foo'));
40
- const wrapper = shallow(menuEl, shallowOptions).dive().dive();
41
- expect(shallowToJson(wrapper).props).not.toHaveProperty('onBlur');
42
- });
43
-
44
- test('open Menu DOM with only required props and element child', function() {
45
- ambManager.isOpen = true;
46
- const menuEl = el(Menu, null, el('div', null, el('div', null, 'foo')));
47
- const wrapper = shallow(menuEl, shallowOptions).dive().dive();
48
- expect(shallowToJson(wrapper)).toMatchSnapshot();
49
- });
50
-
51
- test('closed menu DOM with all possible props and function child', function() {
52
- const childFunction = jest.fn().mockImplementation(function(menuState) {
53
- return 'isOpen = ' + menuState.isOpen;
54
- });
55
- const menuEl = el(
56
- Menu,
57
- {
58
- id: 'foo',
59
- className: 'bar',
60
- style: { bottom: 1 },
61
- tag: 'ul',
62
- 'data-something-something': 'seven' // arbitrary prop
63
- },
64
- childFunction
65
- );
66
- const wrapper = shallow(menuEl, shallowOptions).dive().dive();
67
- expect(shallowToJson(wrapper)).toMatchSnapshot();
68
- expect(childFunction).toHaveBeenCalledTimes(1);
69
- expect(childFunction.mock.calls[0]).toEqual([{ isOpen: false }]);
70
- });
71
-
72
- test('open menu DOM with all possible props and function child', function() {
73
- ambManager.isOpen = true;
74
- const childFunction = jest.fn().mockImplementation(function(menuState) {
75
- return 'isOpen = ' + menuState.isOpen;
76
- });
77
- const menuEl = el(
78
- Menu,
79
- {
80
- id: 'bar',
81
- className: 'foo',
82
- style: { left: 1 },
83
- tag: 'section'
84
- },
85
- childFunction
86
- );
87
- const wrapper = shallow(menuEl, shallowOptions).dive().dive();
88
- expect(shallowToJson(wrapper)).toMatchSnapshot();
89
- expect(childFunction).toHaveBeenCalledTimes(1);
90
- expect(childFunction.mock.calls[0]).toEqual([{ isOpen: true }]);
91
- });
92
-
93
- test('menu updating', function() {
94
- ambManager.menuItems = [1, 2];
95
- const childFunction = jest.fn();
96
-
97
- class LittleApp extends React.Component {
98
- state = { open: false };
99
-
100
- toggleMenu = () => {
101
- this.setState({ open: !this.state.open });
102
- };
103
-
104
- render() {
105
- return el(
106
- MockWrapper,
107
- { mockManager: ambManager },
108
- el(Menu, null, childFunction)
109
- );
110
- }
111
- }
112
-
113
- const wrapper = mount(el(LittleApp));
114
- wrapper.instance().toggleMenu();
115
- expect(ambManager.clearItems).toHaveBeenCalledTimes(1);
116
- });
117
- });
118
-
119
- describe('<Menu> rendered via renderToString', function() {
120
- test('does not throw', function() {
121
- const output = ReactDOMServer.renderToString(
122
- el(
123
- MockWrapper,
124
- { mockManager: createMockManager() },
125
- el(Menu, null, el('div', null, 'foo'))
126
- )
127
- );
128
- expect(output).toMatchSnapshot();
129
- });
130
- });
@@ -1,106 +0,0 @@
1
- const React = require('react');
2
- const ReactDOMServer = require('react-dom/server');
3
- const shallow = require('enzyme').shallow;
4
- const shallowToJson = require('enzyme-to-json').shallowToJson;
5
- const ManagerContext = require('../ManagerContext');
6
- const MenuItem = require('../MenuItem');
7
- const MockWrapper = require('./helpers/MockWrapper');
8
- const createMockKeyEvent = require('./helpers/createMockKeyEvent');
9
- const createMockManager = require('./helpers/createMockManager');
10
-
11
- const el = React.createElement;
12
-
13
- describe('<MenuItem>', function() {
14
- let shallowOptions;
15
- let ambManager;
16
-
17
- beforeEach(function() {
18
- ambManager = createMockManager();
19
- shallowOptions = {
20
- wrappingComponent: ManagerContext.Provider,
21
- wrappingComponentProps: { value: ambManager }
22
- };
23
- });
24
-
25
- it('DOM with only required props', function() {
26
- const menuItem = el(MenuItem, null, 'foo');
27
- const wrapper = shallow(menuItem, shallowOptions).dive().dive();
28
- expect(shallowToJson(wrapper)).toMatchSnapshot();
29
- });
30
-
31
- it('DOM with all possible props and element child', function() {
32
- const menuItem = el(
33
- MenuItem,
34
- {
35
- className: 'foobar',
36
- id: 'hogwash',
37
- tag: 'li',
38
- style: { right: '1em' },
39
- text: 'horse',
40
- value: 'lamb',
41
- 'data-something-something': 'seven' // arbitrary prop
42
- },
43
- el('a', { href: '#' }, 'foo')
44
- );
45
- const wrapper = shallow(menuItem, shallowOptions).dive().dive();
46
- expect(shallowToJson(wrapper)).toMatchSnapshot();
47
- });
48
-
49
- it('click without specified value prop', function() {
50
- const mockEvent = { bee: 'baa' };
51
- const menuItem = el(MenuItem, null, 'foo');
52
- const wrapper = shallow(menuItem, shallowOptions).dive().dive();
53
- wrapper.simulate('click', mockEvent);
54
- expect(ambManager.handleSelection).toHaveBeenCalledTimes(1);
55
- expect(ambManager.handleSelection.mock.calls[0]).toEqual([
56
- 'foo',
57
- mockEvent
58
- ]);
59
- });
60
-
61
- it('click with specified value prop', function() {
62
- const mockEvent = { bee: 'baa' };
63
- const menuItem = el(MenuItem, { value: 'bar' }, 'foo');
64
- const wrapper = shallow(menuItem, shallowOptions).dive().dive();
65
- wrapper.simulate('click', mockEvent);
66
- expect(ambManager.handleSelection).toHaveBeenCalledTimes(1);
67
- expect(ambManager.handleSelection.mock.calls[0]).toEqual([
68
- 'bar',
69
- mockEvent
70
- ]);
71
- });
72
-
73
- it('click with specified value prop', function() {
74
- const mockEnterEvent = createMockKeyEvent('Enter');
75
- const mockSpaceEvent = createMockKeyEvent(' ');
76
- const mockEscapeEvent = createMockKeyEvent('Escape');
77
- const menuItem = el(MenuItem, null, 'foo');
78
- const wrapper = shallow(menuItem, shallowOptions).dive().dive();
79
-
80
- wrapper.simulate('keyDown', mockEnterEvent);
81
- wrapper.simulate('keyDown', mockSpaceEvent);
82
- wrapper.simulate('keyDown', mockEscapeEvent);
83
- expect(ambManager.handleSelection).toHaveBeenCalledTimes(2);
84
- expect(ambManager.handleSelection.mock.calls[0]).toEqual([
85
- 'foo',
86
- mockEnterEvent
87
- ]);
88
- expect(ambManager.handleSelection.mock.calls[1]).toEqual([
89
- 'foo',
90
- mockSpaceEvent
91
- ]);
92
- });
93
- });
94
-
95
- describe('<MenuItem> rendered via renderToString', function() {
96
- it('does not throw', function() {
97
- const output = ReactDOMServer.renderToString(
98
- el(
99
- MockWrapper,
100
- { mockManager: createMockManager() },
101
- el(MenuItem, null, 'foo')
102
- )
103
- );
104
- expect(output).toMatchSnapshot();
105
- });
106
- });
@@ -1,41 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Button> DOM with all possible props and element child 1`] = `
4
- <button
5
- aria-disabled={true}
6
- aria-expanded={false}
7
- aria-haspopup={true}
8
- className="bar"
9
- data-something-something="seven"
10
- disabled={true}
11
- id="foo"
12
- onClick={[Function]}
13
- onKeyDown={[Function]}
14
- role="button"
15
- style={
16
- Object {
17
- "top": 2,
18
- }
19
- }
20
- tabIndex=""
21
- >
22
- <span>
23
- hooha
24
- </span>
25
- </button>
26
- `;
27
-
28
- exports[`<Button> DOM with only required props and text child 1`] = `
29
- <span
30
- aria-expanded={false}
31
- aria-haspopup={true}
32
- onClick={[Function]}
33
- onKeyDown={[Function]}
34
- role="button"
35
- tabIndex="0"
36
- >
37
- foo
38
- </span>
39
- `;
40
-
41
- exports[`<Button> rendered via renderToString does not throw 1`] = `"<div><span role=\\"button\\" tabindex=\\"0\\" aria-haspopup=\\"true\\" aria-expanded=\\"false\\">foo</span></div>"`;
@@ -1,54 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Menu> closed Menu DOM with only required props and element child 1`] = `""`;
4
-
5
- exports[`<Menu> closed menu DOM with all possible props and function child 1`] = `
6
- <ul
7
- className="bar"
8
- data-something-something="seven"
9
- id="foo"
10
- onKeyDown={[Function]}
11
- role="menu"
12
- style={
13
- Object {
14
- "bottom": 1,
15
- }
16
- }
17
- tabIndex={-1}
18
- >
19
- isOpen = false
20
- </ul>
21
- `;
22
-
23
- exports[`<Menu> open Menu DOM with only required props and element child 1`] = `
24
- <div
25
- onKeyDown={[Function]}
26
- role="menu"
27
- tabIndex={-1}
28
- >
29
- <div>
30
- <div>
31
- foo
32
- </div>
33
- </div>
34
- </div>
35
- `;
36
-
37
- exports[`<Menu> open menu DOM with all possible props and function child 1`] = `
38
- <section
39
- className="foo"
40
- id="bar"
41
- onKeyDown={[Function]}
42
- role="menu"
43
- style={
44
- Object {
45
- "left": 1,
46
- }
47
- }
48
- tabIndex={-1}
49
- >
50
- isOpen = true
51
- </section>
52
- `;
53
-
54
- exports[`<Menu> rendered via renderToString does not throw 1`] = `"<div></div>"`;
@@ -1,37 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<MenuItem> DOM with all possible props and element child 1`] = `
4
- <li
5
- className="foobar"
6
- data-something-something="seven"
7
- id="hogwash"
8
- onClick={[Function]}
9
- onKeyDown={[Function]}
10
- role="menuitem"
11
- style={
12
- Object {
13
- "right": "1em",
14
- }
15
- }
16
- tabIndex="-1"
17
- >
18
- <a
19
- href="#"
20
- >
21
- foo
22
- </a>
23
- </li>
24
- `;
25
-
26
- exports[`<MenuItem> DOM with only required props 1`] = `
27
- <div
28
- onClick={[Function]}
29
- onKeyDown={[Function]}
30
- role="menuitem"
31
- tabIndex="-1"
32
- >
33
- foo
34
- </div>
35
- `;
36
-
37
- exports[`<MenuItem> rendered via renderToString does not throw 1`] = `"<div><div role=\\"menuitem\\" tabindex=\\"-1\\">foo</div></div>"`;