Skip to content

Commit 28dbc63

Browse files
committed
[added] Supporting custom overlay className
closes #14
1 parent b15aa82 commit 28dbc63

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/components/ModalPortal.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ var ModalPortal = module.exports = React.createClass({
142142
render: function() {
143143
return this.shouldBeClosed() ? div() : (
144144
div({
145-
className: this.buildClassName('overlay'),
145+
ref: "overlay",
146+
className: cx(this.buildClassName('overlay'), this.props.overlayClassName),
146147
style: this.overlayStyles,
147148
onClick: this.handleOverlayClick
148149
},

specs/Modal.spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ describe('Modal', function () {
104104
unmountModal();
105105
});
106106

107+
it('supports overlayClassName', function () {
108+
var modal = renderModal({isOpen: true, overlayClassName: 'myOverlayClass'});
109+
equal(modal.portal.refs.overlay.getDOMNode().className.contains('myOverlayClass'), true);
110+
unmountModal();
111+
});
112+
107113
it('adds --after-open for animations', function() {
108114
var modal = renderModal({isOpen: true});
109115
var overlay = document.querySelector('.ReactModal__Overlay');

0 commit comments

Comments
 (0)