Skip to content

Commit

Permalink
Handles some weird IE 11 testing cases
Browse files Browse the repository at this point in the history
  • Loading branch information
niksy committed Nov 22, 2019
1 parent d1c6056 commit a568259
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

- `keycode-js` upgrade

### Fixed

- Handling rendering edge cases when testing in IE 11

## [1.3.1][] - 2019-09-12

### Fixed
Expand Down
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ it('should handle blur event for closing', async function() {

goDown(element);

await nextFrame();

assert.ok(nodesExist(['#x-Autosuggest-results-3[aria-expanded="true"]']));

await blurElement(element);
Expand Down Expand Up @@ -297,6 +299,8 @@ it('should hide results if input is disabled', async function() {
goDown(element);
goDown(element);

await nextFrame();

assert.ok(
nodesExist([
'#x-Autosuggest-results-8[role="listbox"][aria-expanded="true"]'
Expand All @@ -314,6 +318,7 @@ it('should hide results if input is disabled', async function() {
);

element.disabled = false;

instance.destroy();
});

Expand Down
7 changes: 4 additions & 3 deletions test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KEY_DOWN, KEY_UP, KEY_ESCAPE, KEY_RETURN, KEY_A } from 'keycode-js';

function nextFrame() {
return new Promise((resolve) => {
setTimeout(resolve, 0);
requestAnimationFrame(resolve);
});
}

Expand Down Expand Up @@ -38,8 +38,9 @@ function nodesExist(selectors) {
return selectors
.map((selector) => {
if (Array.isArray(selector)) {
const node = document.querySelector(selector[0]);
return selector[1](node);
const [selectorQuery, callback] = selector;
const node = document.querySelector(selectorQuery);
return callback(node);
}
return document.querySelector(selector);
})
Expand Down

0 comments on commit a568259

Please sign in to comment.