Skip to content

Commit 529ca33

Browse files
WickyNilliamsdiasbruno
authored andcommittedApr 19, 2018
Add testId prop for use as a test hook
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
1 parent e294dc7 commit 529ca33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/components/ModalPortal.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export default class ModalPortal extends Component {
5454
children: PropTypes.node,
5555
shouldCloseOnEsc: PropTypes.bool,
5656
overlayRef: PropTypes.func,
57-
contentRef: PropTypes.func
57+
contentRef: PropTypes.func,
58+
testId: PropTypes.string
5859
};
5960

6061
constructor(props) {
@@ -346,6 +347,7 @@ export default class ModalPortal extends Component {
346347
role={this.props.role}
347348
aria-label={this.props.contentLabel}
348349
{...this.ariaAttributes(this.props.aria || {})}
350+
data-testid={this.props.testId}
349351
>
350352
{this.props.children}
351353
</div>

0 commit comments

Comments
 (0)