Skip to content

Commit d5c7b93

Browse files
committed
add a test case
1 parent 9caff2c commit d5c7b93

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

specs/Modal.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ describe('Modal', function () {
100100
unmountModal();
101101
});
102102

103+
it('keeps focus inside the modal when child has no tabbable elements', function() {
104+
var tabPrevented = false;
105+
var modal = renderModal({isOpen: true}, 'hello');
106+
strictEqual(document.activeElement, modal.portal.refs.content);
107+
Simulate.keyDown(modal.portal.refs.content, {
108+
key: "Tab",
109+
keyCode: 9,
110+
which: 9,
111+
preventDefault: function() { tabPrevented = true; }
112+
});
113+
equal(tabPrevented, true);
114+
});
115+
103116
it('supports custom className', function() {
104117
var modal = renderModal({isOpen: true, className: 'myClass'});
105118
equal(modal.portal.refs.content.className.contains('myClass'), true);

0 commit comments

Comments
 (0)