Skip to content

Commit 6a6bcf7

Browse files
adammahmooddiasbruno
authored andcommitted
[fixed] Render testId property
1 parent 1b561fc commit 6a6bcf7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: specs/Modal.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,14 @@ export default () => {
417417
unmountModal();
418418
});
419419

420+
it("additional testId attribute", () => {
421+
const modal = renderModal({ isOpen: true, testId: "foo-bar" }, "hello");
422+
mcontent(modal)
423+
.getAttribute("data-testid")
424+
.should.be.eql("foo-bar");
425+
unmountModal();
426+
});
427+
420428
it("raises an exception if the appElement selector does not match", () => {
421429
should(() => ariaAppHider.setElement(".test")).throw();
422430
});

Diff for: src/components/ModalPortal.js

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ export default class ModalPortal extends Component {
348348
aria-label={this.props.contentLabel}
349349
{...this.attributesFromObject("aria", this.props.aria || {})}
350350
{...this.attributesFromObject("data", this.props.data || {})}
351+
data-testid={this.props.testId}
351352
>
352353
{this.props.children}
353354
</div>

0 commit comments

Comments
 (0)