|
1 | 1 | import React from "react"; |
2 | 2 | import ReactDOM from "react-dom"; |
3 | 3 | import ReactTestUtils from "react-addons-test-utils"; |
4 | | -import ReCAPTCHA from "../src/recaptcha"; |
| 4 | +import ReCAPTCHA from "../src/recaptcha"; // eslint-disable-line no-unused-vars |
5 | 5 |
|
6 | 6 | describe("ReCAPTCHA", () => { |
7 | | - it("Rendered Component should be a div", () => { |
8 | | - let instance = ReactTestUtils.renderIntoDocument( |
9 | | - <ReCAPTCHA sitekey="xxx" /> |
| 7 | + it("Rendered Component should be a div", () => { |
| 8 | + const instance = ReactTestUtils.renderIntoDocument( |
| 9 | + <ReCAPTCHA sitekey="xxx" />, |
10 | 10 | ); |
11 | | - assert.equal(ReactDOM.findDOMNode(instance).nodeName, "DIV"); |
12 | | - }); |
13 | | - it("Rendered Component should contained passed props", () => { |
14 | | - let props = { |
15 | | - className: "TheClassName", |
16 | | - id: "superdefinedId", |
17 | | - }; |
18 | | - let instance = ReactTestUtils.renderIntoDocument( |
19 | | - <ReCAPTCHA sitekey="xxx" {...props} /> |
| 11 | + assert.equal(ReactDOM.findDOMNode(instance).nodeName, "DIV"); |
| 12 | + }); |
| 13 | + it("Rendered Component should contained passed props", () => { |
| 14 | + const props = { |
| 15 | + className: "TheClassName", |
| 16 | + id: "superdefinedId", |
| 17 | + }; |
| 18 | + const instance = ReactTestUtils.renderIntoDocument( |
| 19 | + <ReCAPTCHA sitekey="xxx" {...props} />, |
20 | 20 | ); |
21 | | - assert.equal(ReactDOM.findDOMNode(instance).id, props.id); |
22 | | - assert.match(ReactDOM.findDOMNode(instance).className, new RegExp(props.className)); |
23 | | - }); |
| 21 | + assert.equal(ReactDOM.findDOMNode(instance).id, props.id); |
| 22 | + assert.match(ReactDOM.findDOMNode(instance).className, new RegExp(props.className)); |
| 23 | + }); |
24 | 24 |
|
25 | | - it("should call grecaptcha.render, when it is already loaded", (done) => { |
26 | | - let grecaptchaMock = { |
27 | | - render(node, options) { |
28 | | - assert.isNotNull(node); |
29 | | - assert.equal(options.sitekey, "xxx"); |
30 | | - done(); |
31 | | - }, |
32 | | - }; |
33 | | - let instance = ReactTestUtils.renderIntoDocument( |
34 | | - <ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} /> |
| 25 | + it("should call grecaptcha.render, when it is already loaded", (done) => { |
| 26 | + const grecaptchaMock = { |
| 27 | + render (node, options) { |
| 28 | + assert.isNotNull(node); |
| 29 | + assert.equal(options.sitekey, "xxx"); |
| 30 | + done(); |
| 31 | + }, |
| 32 | + }; |
| 33 | + const instance = ReactTestUtils.renderIntoDocument( |
| 34 | + <ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} />, |
35 | 35 | ); |
36 | | - assert.ok(instance); |
37 | | - }); |
38 | | - it("reset, should call grecaptcha.reset with the widget id", (done) => { |
39 | | - let grecaptchaMock = { |
40 | | - render() { |
41 | | - return "someWidgetId"; |
42 | | - }, |
| 36 | + assert.ok(instance); |
| 37 | + }); |
| 38 | + it("reset, should call grecaptcha.reset with the widget id", (done) => { |
| 39 | + const grecaptchaMock = { |
| 40 | + render () { |
| 41 | + return "someWidgetId"; |
| 42 | + }, |
43 | 43 |
|
44 | | - reset(widgetId) { |
45 | | - assert.isNotNull(widgetId); |
46 | | - done(); |
47 | | - }, |
48 | | - }; |
49 | | - let instance = ReactTestUtils.renderIntoDocument( |
50 | | - <ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} /> |
| 44 | + reset (widgetId) { |
| 45 | + assert.isNotNull(widgetId); |
| 46 | + done(); |
| 47 | + }, |
| 48 | + }; |
| 49 | + const instance = ReactTestUtils.renderIntoDocument( |
| 50 | + <ReCAPTCHA sitekey="xxx" grecaptcha={grecaptchaMock} />, |
51 | 51 | ); |
52 | | - instance.reset(); |
53 | | - }); |
54 | | - it("execute, should call grecaptcha.execute with the widget id", (done) => { |
55 | | - let grecaptchaMock = { |
56 | | - render() { |
57 | | - return "someWidgetId"; |
58 | | - }, |
| 52 | + instance.reset(); |
| 53 | + }); |
| 54 | + it("execute, should call grecaptcha.execute with the widget id", (done) => { |
| 55 | + const grecaptchaMock = { |
| 56 | + render () { |
| 57 | + return "someWidgetId"; |
| 58 | + }, |
59 | 59 |
|
60 | | - execute(widgetId) { |
61 | | - assert.isNotNull(widgetId); |
62 | | - done(); |
63 | | - }, |
64 | | - }; |
65 | | - let instance = ReactTestUtils.renderIntoDocument( |
66 | | - <ReCAPTCHA sitekey="xxx" size="invisible" grecaptcha={grecaptchaMock} /> |
| 60 | + execute (widgetId) { |
| 61 | + assert.isNotNull(widgetId); |
| 62 | + done(); |
| 63 | + }, |
| 64 | + }; |
| 65 | + const instance = ReactTestUtils.renderIntoDocument( |
| 66 | + <ReCAPTCHA sitekey="xxx" size="invisible" grecaptcha={grecaptchaMock} />, |
67 | 67 | ); |
68 | | - instance.execute(); |
69 | | - }); |
70 | | - describe("Expired", () => { |
71 | | - it("should call onChange with null when response is expired"); |
72 | | - it("should call onExpired when response is expired"); |
73 | | - }); |
| 68 | + instance.execute(); |
| 69 | + }); |
| 70 | + describe("Expired", () => { |
| 71 | + it("should call onChange with null when response is expired"); |
| 72 | + it("should call onExpired when response is expired"); |
| 73 | + }); |
74 | 74 | }); |
0 commit comments