-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DOM fixtures for disabled button click events
- Loading branch information
Brandon Dail
committed
Mar 29, 2017
1 parent
090efbd
commit c8ab00c
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const React = window.React; | ||
|
||
import FixtureSet from '../../FixtureSet'; | ||
import TestCase from '../../TestCase'; | ||
|
||
function onButtonClick() { | ||
window.alert(`This shouldn't have happened!`); | ||
} | ||
|
||
export default class ButtonTestCases extends React.Component { | ||
render() { | ||
return ( | ||
<FixtureSet title="Buttons"> | ||
<TestCase | ||
title="onClick with disabled buttons" | ||
description="The onClick event handler should not be invoked when clicking on a disabled buyaton"> | ||
<TestCase.Steps> | ||
<li>Click on the disabled button</li> | ||
</TestCase.Steps> | ||
<TestCase.ExpectedResult> | ||
Nothing should happen | ||
</TestCase.ExpectedResult> | ||
<button disabled onClick={onButtonClick}>Click Me</button> | ||
</TestCase> | ||
<TestCase | ||
title="onClick with disabled buttons containing other elements" | ||
description="The onClick event handler should not be invoked when clicking on a disabled button that contains other elements"> | ||
<TestCase.Steps> | ||
<li>Click on the disabled button, which contains a span</li> | ||
</TestCase.Steps> | ||
<TestCase.ExpectedResult> | ||
Nothing should happen | ||
</TestCase.ExpectedResult> | ||
<button disabled onClick={onButtonClick}> | ||
<span>Click Me</span> | ||
</button> | ||
</TestCase> | ||
</FixtureSet> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters