Skip to content

Commit

Permalink
[added] Supporting custom className
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabriskie committed Nov 12, 2014
1 parent b7a38de commit b15aa82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var React = require('react');
var div = React.DOM.div;
var focusManager = require('../helpers/focusManager');
var scopeTab = require('../helpers/scopeTab');
var cx = require('react/lib/cx');

// so that our CSS is statically analyzable
var CLASS_NAMES = {
Expand Down Expand Up @@ -147,7 +148,7 @@ var ModalPortal = module.exports = React.createClass({
},
div({
ref: "content",
className: this.buildClassName('content'),
className: cx(this.buildClassName('content'), this.props.className),
tabIndex: "-1",
onClick: stopPropagation,
onKeyDown: this.handleKeyDown
Expand Down
6 changes: 6 additions & 0 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ describe('Modal', function () {
});
});

it('supports custom className', function() {
var modal = renderModal({isOpen: true, className: 'myClass'});
equal(modal.portal.refs.content.getDOMNode().className.contains('myClass'), true);
unmountModal();
});

it('adds --after-open for animations', function() {
var modal = renderModal({isOpen: true});
var overlay = document.querySelector('.ReactModal__Overlay');
Expand Down

0 comments on commit b15aa82

Please sign in to comment.