@instructure/ui-dom-utils 10.16.1-snapshot-0 → 10.16.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/__new-tests__/addEventListener.test.js +2 -2
  3. package/es/__new-tests__/addInputModeListener.test.js +9 -4
  4. package/es/__new-tests__/addPositionChangeListener.test.js +2 -2
  5. package/es/__new-tests__/findTabbable.test.js +30 -15
  6. package/es/__new-tests__/getClassList.test.js +5 -4
  7. package/es/__new-tests__/getFontSize.test.js +5 -4
  8. package/es/__new-tests__/getOffsetParents.test.js +76 -59
  9. package/es/__new-tests__/getScrollParents.test.js +43 -34
  10. package/es/__new-tests__/isVisible.test.js +52 -37
  11. package/lib/__new-tests__/addEventListener.test.js +4 -5
  12. package/lib/__new-tests__/addInputModeListener.test.js +14 -10
  13. package/lib/__new-tests__/addPositionChangeListener.test.js +4 -5
  14. package/lib/__new-tests__/findTabbable.test.js +31 -17
  15. package/lib/__new-tests__/getClassList.test.js +6 -6
  16. package/lib/__new-tests__/getFontSize.test.js +6 -6
  17. package/lib/__new-tests__/getOffsetParents.test.js +78 -62
  18. package/lib/__new-tests__/getScrollParents.test.js +47 -39
  19. package/lib/__new-tests__/isVisible.test.js +59 -45
  20. package/package.json +4 -4
  21. package/src/__new-tests__/addEventListener.test.tsx +0 -1
  22. package/src/__new-tests__/addInputModeListener.test.tsx +0 -1
  23. package/src/__new-tests__/addPositionChangeListener.test.tsx +0 -1
  24. package/src/__new-tests__/findTabbable.test.tsx +0 -1
  25. package/src/__new-tests__/getClassList.test.tsx +0 -1
  26. package/src/__new-tests__/getFontSize.test.tsx +0 -1
  27. package/src/__new-tests__/getOffsetParents.test.tsx +0 -1
  28. package/src/__new-tests__/getScrollParents.test.tsx +0 -1
  29. package/src/__new-tests__/isVisible.test.tsx +0 -1
  30. package/tsconfig.build.tsbuildinfo +1 -1
  31. package/types/__new-tests__/addEventListener.test.d.ts.map +1 -1
  32. package/types/__new-tests__/addInputModeListener.test.d.ts.map +1 -1
  33. package/types/__new-tests__/addPositionChangeListener.test.d.ts.map +1 -1
  34. package/types/__new-tests__/findTabbable.test.d.ts.map +1 -1
  35. package/types/__new-tests__/getClassList.test.d.ts.map +1 -1
  36. package/types/__new-tests__/getFontSize.test.d.ts.map +1 -1
  37. package/types/__new-tests__/getOffsetParents.test.d.ts.map +1 -1
  38. package/types/__new-tests__/getScrollParents.test.d.ts.map +1 -1
  39. package/types/__new-tests__/isVisible.test.d.ts.map +1 -1
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](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1) (2025-04-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-dom-utils
9
9
 
@@ -23,15 +23,15 @@ var _div;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { fireEvent, render } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import '@testing-library/jest-dom';
30
29
  import { addEventListener } from '../addEventListener';
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
31
31
  describe('addEventListener', () => {
32
32
  it('should add an event listener and provide a remove method', () => {
33
33
  const callback = vi.fn();
34
- const _render = render(_div || (_div = /*#__PURE__*/React.createElement("div", null))),
34
+ const _render = render(_div || (_div = _jsx("div", {}))),
35
35
  container = _render.container;
36
36
  const node = container.firstChild;
37
37
  const listener = addEventListener(node, 'click', callback);
@@ -23,17 +23,22 @@ var _div;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, fireEvent, screen } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import '@testing-library/jest-dom';
30
29
  import { addInputModeListener } from '../addInputModeListener';
30
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
31
31
  describe('addInputModeListener', () => {
32
32
  it('should handle input mode changes', () => {
33
33
  const handleInputModeChange = vi.fn();
34
- render(_div || (_div = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
35
- id: "button-1"
36
- }, "hello"), /*#__PURE__*/React.createElement("button", null, "world"))));
34
+ render(_div || (_div = _jsxs("div", {
35
+ children: [_jsx("button", {
36
+ id: "button-1",
37
+ children: "hello"
38
+ }), _jsx("button", {
39
+ children: "world"
40
+ })]
41
+ })));
37
42
  const inputModeListener = addInputModeListener({
38
43
  onInputModeChange: handleInputModeChange
39
44
  });
@@ -23,11 +23,11 @@ var _div;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, waitFor } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import '@testing-library/jest-dom';
30
29
  import { addPositionChangeListener } from '../addPositionChangeListener';
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
31
31
  const mockRect = {
32
32
  top: 0,
33
33
  left: 0,
@@ -43,7 +43,7 @@ describe('addPositionChangeListener', () => {
43
43
  it('should provide a remove method', async () => {
44
44
  const callback = vi.fn();
45
45
  Element.prototype.getBoundingClientRect = vi.fn(() => mockRect);
46
- const _render = render(_div || (_div = /*#__PURE__*/React.createElement("div", null))),
46
+ const _render = render(_div || (_div = _jsx("div", {}))),
47
47
  container = _render.container;
48
48
  const node = container.firstChild;
49
49
  const listener = addPositionChangeListener(node, callback);
@@ -23,26 +23,37 @@ var _a, _div, _div2, _input, _button, _button2;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import '@testing-library/jest-dom';
29
28
  import { findTabbable } from '../findTabbable';
29
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
30
30
  describe('findTabbable', () => {
31
31
  describe('tabbable content', () => {
32
32
  it('should find tabbable descendants', () => {
33
- const _render = render(/*#__PURE__*/React.createElement("div", null, _a || (_a = /*#__PURE__*/React.createElement("a", {
34
- href: "https://instructure-test"
35
- }, "Tabbable")), _div || (_div = /*#__PURE__*/React.createElement("div", null, "Not Tabbable")), _div2 || (_div2 = /*#__PURE__*/React.createElement("div", {
36
- tabIndex: 1
37
- }, "Tabbable")), _input || (_input = /*#__PURE__*/React.createElement("input", {
38
- type: "text",
39
- value: "Tabbable",
40
- readOnly: true
41
- })), /*#__PURE__*/React.createElement("div", null, _button || (_button = /*#__PURE__*/React.createElement("button", null, "Tabbable")), /*#__PURE__*/React.createElement("button", {
42
- style: {
43
- display: 'none'
44
- }
45
- }, "Not Tabbable")))),
33
+ const _render = render(_jsxs("div", {
34
+ children: [_a || (_a = _jsx("a", {
35
+ href: "https://instructure-test",
36
+ children: "Tabbable"
37
+ })), _div || (_div = _jsx("div", {
38
+ children: "Not Tabbable"
39
+ })), _div2 || (_div2 = _jsx("div", {
40
+ tabIndex: 1,
41
+ children: "Tabbable"
42
+ })), _input || (_input = _jsx("input", {
43
+ type: "text",
44
+ value: "Tabbable",
45
+ readOnly: true
46
+ })), _jsxs("div", {
47
+ children: [_button || (_button = _jsx("button", {
48
+ children: "Tabbable"
49
+ })), _jsx("button", {
50
+ style: {
51
+ display: 'none'
52
+ },
53
+ children: "Not Tabbable"
54
+ })]
55
+ })]
56
+ })),
46
57
  container = _render.container;
47
58
  const node = container.firstChild;
48
59
  expect(findTabbable(node).length).toBe(4);
@@ -51,7 +62,11 @@ describe('findTabbable', () => {
51
62
  describe('tabbable root', () => {
52
63
  it('should search the root node when shouldSearchRootNode is set', () => {
53
64
  const shouldSearchRootNode = true;
54
- const _render2 = render(_button2 || (_button2 = /*#__PURE__*/React.createElement("button", null, /*#__PURE__*/React.createElement("span", null, "hello")))),
65
+ const _render2 = render(_button2 || (_button2 = _jsx("button", {
66
+ children: _jsx("span", {
67
+ children: "hello"
68
+ })
69
+ }))),
55
70
  container = _render2.container;
56
71
  const node = container.firstChild;
57
72
  expect(findTabbable(node).length).toBe(0);
@@ -23,15 +23,16 @@ var _span;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import '@testing-library/jest-dom';
29
28
  import { getClassList } from '../getClassList';
29
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
30
30
  describe('getClassList', () => {
31
31
  it('should provide classlist methods', () => {
32
- const _render = render(_span || (_span = /*#__PURE__*/React.createElement("span", {
33
- className: "foo bar baz"
34
- }, "Test"))),
32
+ const _render = render(_span || (_span = _jsx("span", {
33
+ className: "foo bar baz",
34
+ children: "Test"
35
+ }))),
35
36
  container = _render.container;
36
37
  const node = container.firstChild;
37
38
  const classes = getClassList(node);
@@ -22,17 +22,18 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React from 'react';
26
25
  import { render } from '@testing-library/react';
27
26
  import '@testing-library/jest-dom';
28
27
  import { getFontSize } from '../getFontSize';
28
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
29
29
  describe('getFontSize', () => {
30
30
  it('should return font size as a number', () => {
31
- const _render = render(/*#__PURE__*/React.createElement("span", {
31
+ const _render = render(_jsx("span", {
32
32
  style: {
33
33
  fontSize: '17px'
34
- }
35
- }, "Test")),
34
+ },
35
+ children: "Test"
36
+ })),
36
37
  container = _render.container;
37
38
  const node = container.firstChild;
38
39
  expect(getFontSize(node)).toBe(17);
@@ -23,69 +23,86 @@ var _div;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import '@testing-library/jest-dom';
29
28
  import { getScrollParents } from '../getScrollParents';
29
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
30
30
  describe('getScrollParents', () => {
31
- const node = /*#__PURE__*/React.createElement("div", null, _div || (_div = /*#__PURE__*/React.createElement("div", {
32
- id: "item-1"
33
- }, /*#__PURE__*/React.createElement("div", {
34
- id: "item-2"
35
- }, /*#__PURE__*/React.createElement("span", {
36
- id: "item-3"
37
- }, "Test"), /*#__PURE__*/React.createElement("span", {
38
- id: "sibling-1"
39
- }, "Test"), /*#__PURE__*/React.createElement("span", {
40
- id: "sibling-2"
41
- }, "Test"), /*#__PURE__*/React.createElement("span", {
42
- id: "sibling-3"
43
- }, "Test")))), /*#__PURE__*/React.createElement("div", {
44
- id: "ht",
45
- style: {
46
- height: '50px'
47
- }
48
- }), /*#__PURE__*/React.createElement("div", {
49
- id: "scroll-parent",
50
- style: {
51
- height: '200px',
52
- overflow: 'scroll'
53
- }
54
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
55
- id: "scroll-child",
56
- style: {
57
- height: '500px'
58
- }
59
- }, "Test"))), /*#__PURE__*/React.createElement("div", {
60
- id: "scroll-parent-rel",
61
- style: {
62
- height: '200px',
63
- overflow: 'scroll',
64
- position: 'relative'
65
- }
66
- }, /*#__PURE__*/React.createElement("div", {
67
- style: {
68
- height: '200px',
69
- overflow: 'scroll'
70
- }
71
- }, /*#__PURE__*/React.createElement("div", {
72
- id: "scroll-child-rel",
73
- style: {
74
- height: '500px',
75
- position: 'absolute'
76
- }
77
- }, "Test"))), /*#__PURE__*/React.createElement("div", {
78
- style: {
79
- height: '200px',
80
- overflow: 'scroll'
81
- }
82
- }, /*#__PURE__*/React.createElement("div", {
83
- id: "scroll-child-fixed",
84
- style: {
85
- height: '500px',
86
- position: 'fixed'
87
- }
88
- }, "Test")));
31
+ const node = _jsxs("div", {
32
+ children: [_div || (_div = _jsx("div", {
33
+ id: "item-1",
34
+ children: _jsxs("div", {
35
+ id: "item-2",
36
+ children: [_jsx("span", {
37
+ id: "item-3",
38
+ children: "Test"
39
+ }), _jsx("span", {
40
+ id: "sibling-1",
41
+ children: "Test"
42
+ }), _jsx("span", {
43
+ id: "sibling-2",
44
+ children: "Test"
45
+ }), _jsx("span", {
46
+ id: "sibling-3",
47
+ children: "Test"
48
+ })]
49
+ })
50
+ })), _jsx("div", {
51
+ id: "ht",
52
+ style: {
53
+ height: '50px'
54
+ }
55
+ }), _jsx("div", {
56
+ id: "scroll-parent",
57
+ style: {
58
+ height: '200px',
59
+ overflow: 'scroll'
60
+ },
61
+ children: _jsx("div", {
62
+ children: _jsx("div", {
63
+ id: "scroll-child",
64
+ style: {
65
+ height: '500px'
66
+ },
67
+ children: "Test"
68
+ })
69
+ })
70
+ }), _jsx("div", {
71
+ id: "scroll-parent-rel",
72
+ style: {
73
+ height: '200px',
74
+ overflow: 'scroll',
75
+ position: 'relative'
76
+ },
77
+ children: _jsx("div", {
78
+ style: {
79
+ height: '200px',
80
+ overflow: 'scroll'
81
+ },
82
+ children: _jsx("div", {
83
+ id: "scroll-child-rel",
84
+ style: {
85
+ height: '500px',
86
+ position: 'absolute'
87
+ },
88
+ children: "Test"
89
+ })
90
+ })
91
+ }), _jsx("div", {
92
+ style: {
93
+ height: '200px',
94
+ overflow: 'scroll'
95
+ },
96
+ children: _jsx("div", {
97
+ id: "scroll-child-fixed",
98
+ style: {
99
+ height: '500px',
100
+ position: 'fixed'
101
+ },
102
+ children: "Test"
103
+ })
104
+ })]
105
+ });
89
106
  beforeEach(() => {
90
107
  render(node);
91
108
  });
@@ -23,45 +23,54 @@ var _div, _div2;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render } from '@testing-library/react';
28
27
  import '@testing-library/jest-dom';
29
28
  import { getOffsetParents } from '../getOffsetParents';
29
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
30
30
  describe('getOffsetParents', () => {
31
31
  // At rendering, we receive the node_wrapper and the body as extra offsetParents
32
- const node = /*#__PURE__*/React.createElement("div", {
33
- "data-testid": "node"
34
- }, /*#__PURE__*/React.createElement("div", {
35
- "data-testid": "child_1_wrapper_parent",
36
- style: {
37
- transform: '200px',
38
- position: 'relative'
39
- }
40
- }, /*#__PURE__*/React.createElement("div", {
41
- "data-testid": "child_1_wrapper"
42
- }, /*#__PURE__*/React.createElement("div", {
43
- "data-testid": "child-1",
44
- style: {
45
- height: '500px'
46
- }
47
- }, "Test"))), /*#__PURE__*/React.createElement("div", {
48
- "data-testid": "child_2_wrapper_parent",
49
- style: {
50
- transform: '200px',
51
- position: 'absolute'
52
- }
53
- }, /*#__PURE__*/React.createElement("div", {
54
- "data-testid": "child_2_wrapper",
55
- style: {
56
- position: 'absolute'
57
- }
58
- }, _div || (_div = /*#__PURE__*/React.createElement("div", {
59
- "data-testid": "child-2"
60
- }, "Test")))), _div2 || (_div2 = /*#__PURE__*/React.createElement("div", {
61
- "data-testid": "child_3_wrapper"
62
- }, /*#__PURE__*/React.createElement("div", {
63
- "data-testid": "child-3"
64
- }, "Test"))));
32
+ const node = _jsxs("div", {
33
+ "data-testid": "node",
34
+ children: [_jsx("div", {
35
+ "data-testid": "child_1_wrapper_parent",
36
+ style: {
37
+ transform: '200px',
38
+ position: 'relative'
39
+ },
40
+ children: _jsx("div", {
41
+ "data-testid": "child_1_wrapper",
42
+ children: _jsx("div", {
43
+ "data-testid": "child-1",
44
+ style: {
45
+ height: '500px'
46
+ },
47
+ children: "Test"
48
+ })
49
+ })
50
+ }), _jsx("div", {
51
+ "data-testid": "child_2_wrapper_parent",
52
+ style: {
53
+ transform: '200px',
54
+ position: 'absolute'
55
+ },
56
+ children: _jsx("div", {
57
+ "data-testid": "child_2_wrapper",
58
+ style: {
59
+ position: 'absolute'
60
+ },
61
+ children: _div || (_div = _jsx("div", {
62
+ "data-testid": "child-2",
63
+ children: "Test"
64
+ }))
65
+ })
66
+ }), _div2 || (_div2 = _jsx("div", {
67
+ "data-testid": "child_3_wrapper",
68
+ children: _jsx("div", {
69
+ "data-testid": "child-3",
70
+ children: "Test"
71
+ })
72
+ }))]
73
+ });
65
74
  it('should find offset parent for inline elements', () => {
66
75
  const _render = render(node),
67
76
  getByTestId = _render.getByTestId;
@@ -23,26 +23,29 @@ var _div;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { render, screen } from '@testing-library/react';
28
27
  import '@testing-library/jest-dom';
29
28
  import { isVisible } from '../isVisible';
29
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
30
30
  describe('isVisible', () => {
31
31
  it('should recognize visible elements', () => {
32
- render(_div || (_div = /*#__PURE__*/React.createElement("div", {
33
- "data-testid": "test"
34
- }, "Hello world!")));
32
+ render(_div || (_div = _jsx("div", {
33
+ "data-testid": "test",
34
+ children: "Hello world!"
35
+ })));
35
36
  const element = screen.getByTestId('test');
36
37
  expect(isVisible(element)).toBe(true);
37
38
  });
38
39
  it('should recognize elements with display: none', () => {
39
- render(/*#__PURE__*/React.createElement("div", {
40
- "data-testid": "test"
41
- }, /*#__PURE__*/React.createElement("span", {
42
- style: {
43
- display: 'none'
44
- }
45
- }, "Hello world!")));
40
+ render(_jsx("div", {
41
+ "data-testid": "test",
42
+ children: _jsx("span", {
43
+ style: {
44
+ display: 'none'
45
+ },
46
+ children: "Hello world!"
47
+ })
48
+ }));
46
49
  const element = screen.getByTestId('test').firstChild;
47
50
  expect(isVisible(element)).toBe(false);
48
51
  });
@@ -52,11 +55,13 @@ describe('isVisible', () => {
52
55
  overflow: 'hidden',
53
56
  clip: 'rect(0,0,0,0)'
54
57
  };
55
- render(/*#__PURE__*/React.createElement("div", {
56
- "data-testid": "test"
57
- }, /*#__PURE__*/React.createElement("span", {
58
- style: style
59
- }, "Hello world!")));
58
+ render(_jsx("div", {
59
+ "data-testid": "test",
60
+ children: _jsx("span", {
61
+ style: style,
62
+ children: "Hello world!"
63
+ })
64
+ }));
60
65
  const element = screen.getByTestId('test').firstChild;
61
66
  expect(isVisible(element)).toBe(false);
62
67
  });
@@ -66,11 +71,13 @@ describe('isVisible', () => {
66
71
  overflow: 'hidden',
67
72
  clip: 'rect(0,0,10px,0)'
68
73
  };
69
- render(/*#__PURE__*/React.createElement("div", {
70
- "data-testid": "test"
71
- }, /*#__PURE__*/React.createElement("span", {
72
- style: style
73
- }, "Hello world!")));
74
+ render(_jsx("div", {
75
+ "data-testid": "test",
76
+ children: _jsx("span", {
77
+ style: style,
78
+ children: "Hello world!"
79
+ })
80
+ }));
74
81
  const element = screen.getByTestId('test').firstChild;
75
82
  expect(isVisible(element)).toBe(true);
76
83
  });
@@ -78,15 +85,19 @@ describe('isVisible', () => {
78
85
  const style = {
79
86
  visibility: 'hidden'
80
87
  };
81
- render(/*#__PURE__*/React.createElement("div", {
88
+ render(_jsx("div", {
82
89
  "data-testid": "test",
83
- style: style
84
- }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
85
- "data-testid": "test-2",
86
- style: {
87
- visibility: 'visible'
88
- }
89
- }, "Hello world!"))));
90
+ style: style,
91
+ children: _jsx("span", {
92
+ children: _jsx("span", {
93
+ "data-testid": "test-2",
94
+ style: {
95
+ visibility: 'visible'
96
+ },
97
+ children: "Hello world!"
98
+ })
99
+ })
100
+ }));
90
101
  const element = screen.getByTestId('test-2');
91
102
  expect(isVisible(element, false)).toBe(true);
92
103
  expect(isVisible(element)).toBe(false);
@@ -95,15 +106,19 @@ describe('isVisible', () => {
95
106
  const style = {
96
107
  visibility: 'hidden'
97
108
  };
98
- render(/*#__PURE__*/React.createElement("div", {
109
+ render(_jsx("div", {
99
110
  "data-testid": "test",
100
- style: style
101
- }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
102
- "data-testid": "test-2",
103
- style: {
104
- visibility: 'visible'
105
- }
106
- }, "Hello world!"))));
111
+ style: style,
112
+ children: _jsx("span", {
113
+ children: _jsx("span", {
114
+ "data-testid": "test-2",
115
+ style: {
116
+ visibility: 'visible'
117
+ },
118
+ children: "Hello world!"
119
+ })
120
+ })
121
+ }));
107
122
  const element = screen.getByTestId('test-2').firstChild;
108
123
  expect(isVisible(element, false)).toBe(true);
109
124
  expect(isVisible(element)).toBe(false);
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _react = _interopRequireDefault(require("react"));
5
- var _react2 = require("@testing-library/react");
3
+ var _react = require("@testing-library/react");
6
4
  var _vitest = require("vitest");
7
5
  require("@testing-library/jest-dom");
8
6
  var _addEventListener = require("../addEventListener");
7
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
8
  var _div;
10
9
  /*
11
10
  * The MIT License (MIT)
@@ -33,11 +32,11 @@ var _div;
33
32
  describe('addEventListener', () => {
34
33
  it('should add an event listener and provide a remove method', () => {
35
34
  const callback = _vitest.vi.fn();
36
- const _render = (0, _react2.render)(_div || (_div = /*#__PURE__*/_react.default.createElement("div", null))),
35
+ const _render = (0, _react.render)(_div || (_div = (0, _jsxRuntime.jsx)("div", {}))),
37
36
  container = _render.container;
38
37
  const node = container.firstChild;
39
38
  const listener = (0, _addEventListener.addEventListener)(node, 'click', callback);
40
- _react2.fireEvent.click(node);
39
+ _react.fireEvent.click(node);
41
40
  expect(callback).toHaveBeenCalledTimes(1);
42
41
  expect(typeof listener.remove).toBe('function');
43
42
  listener.remove();
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _react = _interopRequireDefault(require("react"));
5
- var _react2 = require("@testing-library/react");
3
+ var _react = require("@testing-library/react");
6
4
  var _vitest = require("vitest");
7
5
  require("@testing-library/jest-dom");
8
6
  var _addInputModeListener = require("../addInputModeListener");
7
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
8
  var _div;
10
9
  /*
11
10
  * The MIT License (MIT)
@@ -33,22 +32,27 @@ var _div;
33
32
  describe('addInputModeListener', () => {
34
33
  it('should handle input mode changes', () => {
35
34
  const handleInputModeChange = _vitest.vi.fn();
36
- (0, _react2.render)(_div || (_div = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
37
- id: "button-1"
38
- }, "hello"), /*#__PURE__*/_react.default.createElement("button", null, "world"))));
35
+ (0, _react.render)(_div || (_div = (0, _jsxRuntime.jsxs)("div", {
36
+ children: [(0, _jsxRuntime.jsx)("button", {
37
+ id: "button-1",
38
+ children: "hello"
39
+ }), (0, _jsxRuntime.jsx)("button", {
40
+ children: "world"
41
+ })]
42
+ })));
39
43
  const inputModeListener = (0, _addInputModeListener.addInputModeListener)({
40
44
  onInputModeChange: handleInputModeChange
41
45
  });
42
- const button = _react2.screen.getByRole('button', {
46
+ const button = _react.screen.getByRole('button', {
43
47
  name: 'hello'
44
48
  });
45
- _react2.fireEvent.mouseUp(button);
49
+ _react.fireEvent.mouseUp(button);
46
50
  expect(inputModeListener.isKeyboardMode()).toBe(false);
47
- _react2.fireEvent.keyDown(button);
51
+ _react.fireEvent.keyDown(button);
48
52
  expect(inputModeListener.isKeyboardMode()).toBe(true);
49
53
  expect(handleInputModeChange).toHaveBeenCalledTimes(2);
50
54
  inputModeListener.remove();
51
- _react2.fireEvent.mouseUp(button);
55
+ _react.fireEvent.mouseUp(button);
52
56
  expect(inputModeListener.isKeyboardMode()).toBe(true);
53
57
  expect(handleInputModeChange).toHaveBeenCalledTimes(2);
54
58
  });