Skip to content

Commit

Permalink
fix(enableescclose): default to true
Browse files Browse the repository at this point in the history
  • Loading branch information
devanp92 authored and plwalters committed Dec 23, 2016
1 parent c0baaf5 commit 58bfc88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dialog-renderer.js
Expand Up @@ -47,7 +47,7 @@ export class DialogRenderer {
_escapeKeyEventHandler = (e) => {
if (e.keyCode === 27) {
let top = this._dialogControllers[this._dialogControllers.length - 1];
if (top && (top.settings.lock !== true && !top.settings.enableEscClose)) {
if (top && (top.settings.lock !== true && top.settings.enableEscClose)) {
top.cancel();
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/dialog-renderer.spec.js
Expand Up @@ -68,7 +68,7 @@ describe('the Dialog Renderer', () => {
});

it('does close the top dialog, when not locked, on ESC', function (done) {
const settings = { lock: false };
const settings = { lock: false, enableEscClose: true };
const expectedEndCount = 1;
const first = createDialogController(settings);
const last = createDialogController(settings);
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('the Dialog Renderer', () => {
expect(last.renderer._dialogControllers.length).toBe(expectedEndCount);
last.renderer._escapeKeyEventHandler({ keyCode: 27 });
expect(first.cancel).not.toHaveBeenCalled();
expect(last.cancel).not.toHaveBeenCalled();
expect(last.cancel).toHaveBeenCalled();
expect(last.renderer._dialogControllers.length).toBe(expectedEndCount);
done();
});
Expand Down

0 comments on commit 58bfc88

Please sign in to comment.