Skip to content

Commit

Permalink
Add test for fieldsets
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Jan 18, 2021
1 parent 9a21507 commit 78b2ceb
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ describe('SimpleEventPlugin', function() {
expect(onClick).toHaveBeenCalledTimes(0);
});

it('does not register a click when clicking a child of a disabled fieldset', function() {
// TODO: This test passes in JSDOM but fails in browsers.
// Once the bug is fixed upstream, this test will likely fail
// Unless we've fixed the root cause already.
const element = mounted(
<fieldset disabled={true}>
<button onClick={onClick}>
Click should not be registered here
<span>(or here)</span>
</button>
</fieldset>,
);
const child = element.querySelector('span');

child.click();
expect(onClick).toHaveBeenCalledTimes(0);
});

it('triggers click events for children of disabled elements', function() {
const element = mounted(
<button disabled={true}>
Expand Down

0 comments on commit 78b2ceb

Please sign in to comment.