Skip to content

Commit

Permalink
Merge pull request dozoisch#12 from spicydonuts/master
Browse files Browse the repository at this point in the history
  • Loading branch information
dozoisch committed Oct 15, 2015
2 parents cf7078b + 5841582 commit 0ac46e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/dozoisch/react-google-recaptcha",
"peerDependencies": {
"react": ">=0.13"
"react": ">=0.14"
},
"devDependencies": {
"babel": "~5.8.21",
Expand All @@ -56,10 +56,11 @@
"karma-webpack": "~1.7.0",
"lodash": "~3.10.1",
"mocha": "~2.2.5",
"react": "~0.13.3",
"phantomjs": "^1.9.18",
"react": "~0.14.0",
"react-dom": "~0.14.0",
"webpack": "~1.11.0",
"yargs": "~3.19.0"

},
"dependencies": {
"babel-runtime": "^5.8.0",
Expand Down
6 changes: 3 additions & 3 deletions src/recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const ReCAPTCHA = React.createClass({

explicitRender(cb) {
if (this.props.grecaptcha && !this.state.widgetId) {
this.captcha.getDOMNode();
let id = this.props.grecaptcha.render(this.captcha.getDOMNode(), {
this.refs.captcha;
let id = this.props.grecaptcha.render(this.refs.captcha, {
sitekey: this.props.sitekey,
callback: this.props.onChange,
theme: this.props.theme,
Expand Down Expand Up @@ -79,7 +79,7 @@ const ReCAPTCHA = React.createClass({
let { sitekey, onChange, theme, type, tabindex, onExpired, size, ...childProps } = this.props;
/* eslint-enable no-unused-vars */
return (
<div {...childProps} ref={(component) => { this.captcha = component; }} />
<div {...childProps} ref="captcha" />
);
},
});
Expand Down
7 changes: 4 additions & 3 deletions test/recaptcha-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import ReactTestUtils from "react/lib/ReactTestUtils";
import ReCAPTCHA from "../src/recaptcha";

Expand All @@ -7,7 +8,7 @@ describe("ReCAPTCHA", () => {
let instance = ReactTestUtils.renderIntoDocument(
<ReCAPTCHA sitekey="xxx" />
);
assert.equal(instance.getDOMNode().nodeName, "DIV");
assert.equal(ReactDOM.findDOMNode(instance).nodeName, "DIV");
});
it("Rendered Component should contained passed props", () => {
let props = {
Expand All @@ -17,8 +18,8 @@ describe("ReCAPTCHA", () => {
let instance = ReactTestUtils.renderIntoDocument(
<ReCAPTCHA sitekey="xxx" {...props} />
);
assert.equal(instance.getDOMNode().id, props.id);
assert.match(instance.getDOMNode().className, new RegExp(props.className));
assert.equal(ReactDOM.findDOMNode(instance).id, props.id);
assert.match(ReactDOM.findDOMNode(instance).className, new RegExp(props.className));
});

it("should call grecaptcha.render, when it is already loaded", (done) => {
Expand Down

0 comments on commit 0ac46e9

Please sign in to comment.