From 6a6bcf72aee2597b21a2b0b95dfd4a4efb77ce56 Mon Sep 17 00:00:00 2001 From: Adam Mahmood Date: Fri, 5 Oct 2018 12:24:57 +0100 Subject: [PATCH] [fixed] Render `testId` property --- specs/Modal.spec.js | 8 ++++++++ src/components/ModalPortal.js | 1 + 2 files changed, 9 insertions(+) diff --git a/specs/Modal.spec.js b/specs/Modal.spec.js index d008dbf0..cf3d3d44 100644 --- a/specs/Modal.spec.js +++ b/specs/Modal.spec.js @@ -417,6 +417,14 @@ export default () => { unmountModal(); }); + it("additional testId attribute", () => { + const modal = renderModal({ isOpen: true, testId: "foo-bar" }, "hello"); + mcontent(modal) + .getAttribute("data-testid") + .should.be.eql("foo-bar"); + unmountModal(); + }); + it("raises an exception if the appElement selector does not match", () => { should(() => ariaAppHider.setElement(".test")).throw(); }); diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js index e50d9911..4d852193 100644 --- a/src/components/ModalPortal.js +++ b/src/components/ModalPortal.js @@ -348,6 +348,7 @@ export default class ModalPortal extends Component { aria-label={this.props.contentLabel} {...this.attributesFromObject("aria", this.props.aria || {})} {...this.attributesFromObject("data", this.props.data || {})} + data-testid={this.props.testId} > {this.props.children}