Skip to content

Commit b12f081

Browse files
committed
[Fix] dom.keys is an iterator, not a map.
1 parent 4684e31 commit b12f081

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

__tests__/src/util/isInteractiveElement-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import expect from 'expect';
33
import { elementType } from 'jsx-ast-utils';
44
import isInteractiveElement from '../../../src/util/isInteractiveElement';
5+
import JSXElementMock from '../../../__mocks__/JSXElementMock';
56
import {
67
genElementSymbol,
78
genIndeterminantInteractiveElements,
@@ -78,4 +79,9 @@ describe('isInteractiveElement', () => {
7879
},
7980
);
8081
});
82+
describe('JSX elements', () => {
83+
it('is not interactive', () => {
84+
expect(isInteractiveElement('CustomComponent', JSXElementMock())).toBe(false);
85+
});
86+
});
8187
});

src/util/isInteractiveElement.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import includes from 'array-includes';
1515
import attributesComparator from './attributesComparator';
1616

17+
const domKeys = [...dom.keys()];
1718
const roleKeys = [...roles.keys()];
1819
const elementRoleEntries = [...elementRoles];
1920

@@ -145,7 +146,7 @@ const isInteractiveElement = (
145146
): boolean => {
146147
// Do not test higher level JSX components, as we do not know what
147148
// low-level DOM element this maps to.
148-
if (!dom.keys(tagName)) {
149+
if (!includes(domKeys, tagName)) {
149150
return false;
150151
}
151152

0 commit comments

Comments
 (0)