Skip to content

Commit b76a304

Browse files
Popup: Add unit test to ensure nested editors closing correctly
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Ruslan Farkhutdinov <fr3ddy4@yandex.ru>
1 parent e6411cb commit b76a304

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.tests.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,25 @@ QUnit.module('keyboard navigation', {
26952695

26962696
assert.strictEqual(this.popup.option('visible'), false, 'popup is closed after pressing esc on a child element');
26972697
});
2698+
2699+
QUnit.test('should remain visible when child element prevents default on escape key press', function(assert) {
2700+
this.init({ dragEnabled: false });
2701+
2702+
const $input = $('<input>').appendTo(this.popup.$content());
2703+
2704+
$input.on('keydown', (e) => {
2705+
const isEscape = e.key === 'Escape' || e.which === 27;
2706+
if(isEscape) {
2707+
e.preventDefault();
2708+
}
2709+
});
2710+
2711+
const keyboard = keyboardMock($input);
2712+
2713+
keyboard.keyDown('esc');
2714+
2715+
assert.strictEqual(this.popup.option('visible'), true, 'popup remains visible after pressing esc on a child element that prevents default');
2716+
});
26982717
});
26992718

27002719
QUnit.module('rendering', {

0 commit comments

Comments
 (0)