Skip to content

Commit

Permalink
Add testId prop for use as a test hook
Browse files Browse the repository at this point in the history
Rather than allow arbitrary `data-*` attributes, I thought a simpler solution would be to have a specific prop for `testId`. Draft-js has a similar approach
  • Loading branch information
WickyNilliams authored and diasbruno committed Apr 19, 2018
1 parent e294dc7 commit 529ca33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export default class ModalPortal extends Component {
children: PropTypes.node,
shouldCloseOnEsc: PropTypes.bool,
overlayRef: PropTypes.func,
contentRef: PropTypes.func
contentRef: PropTypes.func,
testId: PropTypes.string
};

constructor(props) {
Expand Down Expand Up @@ -346,6 +347,7 @@ export default class ModalPortal extends Component {
role={this.props.role}
aria-label={this.props.contentLabel}
{...this.ariaAttributes(this.props.aria || {})}
data-testid={this.props.testId}
>
{this.props.children}
</div>
Expand Down

0 comments on commit 529ca33

Please sign in to comment.