Skip to content

Commit

Permalink
Add test for previewing prop change
Browse files Browse the repository at this point in the history
  • Loading branch information
itsravenous committed Dec 11, 2015
1 parent a9b4073 commit 59d5b1b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/components/markdown-editor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,28 @@ describe('MarkdownEditor', () => {
});
});

describe("#componentWillReceiveProps", () => {
it("should set state.previewing to the value of the previewing prop (after mount)", () => {
// We can't manipulate props of editor directly, so create a parent component to do it via render
var TestParent = React.createFactory(React.createClass({
getInitialState() {
return {
previewing: true
};
},
render() {
return <MarkdownEditor ref="editor" previewing={this.state.previewing} value="##blah blash" />
}
}));

var parent = TestUtils.renderIntoDocument(TestParent());
parent.setState({
previewing: false
});
expect(parent.refs.editor.state.previewing).to.be.false;
});
});

describe("#render", () => {
[["insert-link", "InsertLink"],
["insert-image", "InsertImage"],
Expand Down

0 comments on commit 59d5b1b

Please sign in to comment.