Skip to content

Commit

Permalink
Added test for tabbing with radio as last element
Browse files Browse the repository at this point in the history
  • Loading branch information
loganscharen authored Mar 8, 2024
1 parent 35f7eb0 commit ed2b7dc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions specs/Modal.events.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,26 @@ export default () => {
});
});

it("traps tab in the modal on tab with radio button as last element", () => {
const topButton = <button>top</button>;
const radio1 = <input id="radio-a" name="radios" type="radio" />;
const radio2 = <input id="radio-b" name="radios" type="radio" />;
const modalContent = (
<div>
{topButton}
{radio1}
{radio2}
</div>
);
const props = { isOpen: true };
withModal(props, modalContent, modal => {
const content = mcontent(modal);
tabKeyDown(content);
tabKeyDown(content);
document.activeElement.textContent.should.be.eql("top");
});
});

describe("shouldCloseOnEsc", () => {
context("when true", () => {
it("should close on Esc key event", () => {
Expand Down

0 comments on commit ed2b7dc

Please sign in to comment.