diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js index 6d2becac..b9ad2ee0 100644 --- a/src/__tests__/element-queries.js +++ b/src/__tests__/element-queries.js @@ -385,6 +385,9 @@ test('queryAllByRole returns semantic html elements', () => {

Heading 4

Heading 5
Heading 6
+ + +
  1. @@ -429,6 +432,7 @@ test('queryAllByRole returns semantic html elements', () => { expect(queryAllByRole('row')).toHaveLength(3) expect(queryAllByRole(/rowgroup/i)).toHaveLength(2) expect(queryAllByRole(/(table)|(textbox)/i)).toHaveLength(3) + expect(queryAllByRole(/img/i)).toHaveLength(1) }) test('getAll* matchers return an array', () => { diff --git a/src/role-helpers.js b/src/role-helpers.js index 281e3e0c..14bbe735 100644 --- a/src/role-helpers.js +++ b/src/role-helpers.js @@ -26,7 +26,7 @@ function shouldExcludeFromA11yTree(element) { let visibility = computedStyle.visibility let currentElement = element - while (currentElement !== null) { + while (currentElement) { if (currentElement.hidden === true) { return true }