forked from busyorg/react-google-recaptcha
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34d5e0c
commit b2e5296
Showing
8 changed files
with
106 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.js] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{package.json,.travis.yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import ReactTestUtils from "react-addons-test-utils"; | ||
import ReCAPTCHA from "../src/recaptcha"; | ||
import ReCAPTCHA from "../src/recaptcha"; // eslint-disable-line no-unused-vars | ||
|
||
describe("ReCAPTCHA", () => { | ||
it("Rendered Component should be a div", () => { | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" /> | ||
it("Rendered Component should be a div", () => { | ||
const instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" />, | ||
); | ||
assert.equal(ReactDOM.findDOMNode(instance).nodeName, "DIV"); | ||
}); | ||
it("Rendered Component should contained passed props", () => { | ||
let props = { | ||
className: "TheClassName", | ||
id: "superdefinedId", | ||
}; | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" {...props} /> | ||
assert.equal(ReactDOM.findDOMNode(instance).nodeName, "DIV"); | ||
}); | ||
it("Rendered Component should contained passed props", () => { | ||
const props = { | ||
className: "TheClassName", | ||
id: "superdefinedId", | ||
}; | ||
const instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" {...props} />, | ||
); | ||
assert.equal(ReactDOM.findDOMNode(instance).id, props.id); | ||
assert.match(ReactDOM.findDOMNode(instance).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) => { | ||
let grecaptchaMock = { | ||
render(node, options) { | ||
assert.isNotNull(node); | ||
assert.equal(options.sitekey, "xxx"); | ||
done(); | ||
}, | ||
}; | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} /> | ||
it("should call grecaptcha.render, when it is already loaded", (done) => { | ||
const grecaptchaMock = { | ||
render (node, options) { | ||
assert.isNotNull(node); | ||
assert.equal(options.sitekey, "xxx"); | ||
done(); | ||
}, | ||
}; | ||
const instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} />, | ||
); | ||
assert.ok(instance); | ||
}); | ||
it("reset, should call grecaptcha.reset with the widget id", (done) => { | ||
let grecaptchaMock = { | ||
render() { | ||
return "someWidgetId"; | ||
}, | ||
assert.ok(instance); | ||
}); | ||
it("reset, should call grecaptcha.reset with the widget id", (done) => { | ||
const grecaptchaMock = { | ||
render () { | ||
return "someWidgetId"; | ||
}, | ||
|
||
reset(widgetId) { | ||
assert.isNotNull(widgetId); | ||
done(); | ||
}, | ||
}; | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} /> | ||
reset (widgetId) { | ||
assert.isNotNull(widgetId); | ||
done(); | ||
}, | ||
}; | ||
const instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} />, | ||
); | ||
instance.reset(); | ||
}); | ||
it("execute, should call grecaptcha.execute with the widget id", (done) => { | ||
let grecaptchaMock = { | ||
render() { | ||
return "someWidgetId"; | ||
}, | ||
instance.reset(); | ||
}); | ||
it("execute, should call grecaptcha.execute with the widget id", (done) => { | ||
const grecaptchaMock = { | ||
render () { | ||
return "someWidgetId"; | ||
}, | ||
|
||
execute(widgetId) { | ||
assert.isNotNull(widgetId); | ||
done(); | ||
}, | ||
}; | ||
let instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" size="invisible" grecaptcha={grecaptchaMock} /> | ||
execute (widgetId) { | ||
assert.isNotNull(widgetId); | ||
done(); | ||
}, | ||
}; | ||
const instance = ReactTestUtils.renderIntoDocument( | ||
<ReCAPTCHA sitekey="xxx" size="invisible" grecaptcha={grecaptchaMock} />, | ||
); | ||
instance.execute(); | ||
}); | ||
describe("Expired", () => { | ||
it("should call onChange with null when response is expired"); | ||
it("should call onExpired when response is expired"); | ||
}); | ||
instance.execute(); | ||
}); | ||
describe("Expired", () => { | ||
it("should call onChange with null when response is expired"); | ||
it("should call onExpired when response is expired"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters