Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Select screen index zero based to match config array. (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
FostUK authored Aug 1, 2019
1 parent 4e4daaa commit 546676e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

| Version | Description |
|---------|-------------|
| 2.0.4 | |
| | Button accessibility hot fix. (CGPROD-1577) |
| 2.0.3 | |
| | Select screen index zero based to match config array. |
| | Remove achievement audio. |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genie",
"version": "2.0.1",
"version": "2.0.4",
"description": "Genie - A Modular Game Engine",
"license": "Apache-2.0",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion src/core/accessibility/element-manipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const callOnNextTick = fn => setTimeout(fn, 0);
const resetElementToDefault = (el, self) => {
el.removeEventListener("blur", self);
callOnNextTick(() => {
el.parentElement.removeChild(el);
el.parentElement && el.parentElement.removeChild(el);
showElement(el);
unsetElementAsHiddenAndDisabled(el);
});
Expand Down
9 changes: 9 additions & 0 deletions test/core/accessibility/element-manipulator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ describe("element manipulator", () => {
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(element.parentElement.removeChild).toHaveBeenCalledWith(element);
});

test("does not error if parentElement is null (caused by race condition)", () => {
jest.useFakeTimers();
delete element.parentElement;
resetElement();
jest.runAllTimers();

expect(setTimeout).toHaveBeenCalledTimes(1);
});
});

describe("showElement Method", () => {
Expand Down

0 comments on commit 546676e

Please sign in to comment.