diff --git a/package.json b/package.json index e447f855a0..8921997f15 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "build": "babel-node tools/build-cli.js", "test-watch": "karma start", - "test": "npm run lint && npm run build && karma start --single-run", + "test": "npm run lint && npm run build && karma start --single-run && _mocha --compilers js:babel-core/register './test/server/*Spec.js'", "lint": "eslint ./", "docs-build": "babel-node tools/build-cli.js --docs-only", "docs": "docs/dev-run", diff --git a/src/Modal.js b/src/Modal.js index 5657bf4102..3989cb68f5 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -43,7 +43,7 @@ const Modal = React.createClass({ let classes = { modal: true, fade: this.props.animation, - 'in': !this.props.animation || !document.querySelectorAll + 'in': !this.props.animation }; let modal = ( @@ -72,11 +72,10 @@ const Modal = React.createClass({ renderBackdrop(modal) { let classes = { 'modal-backdrop': true, - 'fade': this.props.animation + fade: this.props.animation, + 'in': !this.props.animation }; - classes.in = !this.props.animation || !document.querySelectorAll; - let onClick = this.props.backdrop === true ? this.handleBackdropClick : null; diff --git a/test/server/ModalSpec.js b/test/server/ModalSpec.js new file mode 100644 index 0000000000..e78832c956 --- /dev/null +++ b/test/server/ModalSpec.js @@ -0,0 +1,17 @@ +import React from 'react'; +import {assert} from 'chai'; +import Modal from '../../src/Modal.js'; + +describe('Modal', () => { + it('Should be rendered on the server side', function () { + let noOp = () => {}; + + assert.doesNotThrow(function renderOnServerSide() { + return React.renderToString( + + Message + + ); + }); + }); +});