optimize spec
yiminghe committed
Jun 24, 2015 at 17:13 UTC
ee831d755093f5b1ab2b984c85ab4941af7c98a5
1 file changed
+3
-17
src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js
+3
-17
@@ -11,22 +11,10 @@
11
12
'use strict';
13
14
-var mocks = require('mocks');
14
var React = require('React');
15
+var ReactTestUtils = require('ReactTestUtils');
16
17
describe('ChangeEventPlugin', function() {
18
- var container;
19
-
20
- beforeEach(function() {
21
- container = document.createElement('div');
22
- document.body.appendChild(container);
23
- });
24
-
25
- afterEach(function() {
26
- React.unmountComponentAtNode(container);
27
- document.body.removeChild(container);
28
- });
29
-
18
it('should fire change for checkbox input', function() {
19
var called = 0;
20
@@ -35,10 +23,8 @@ describe('ChangeEventPlugin', function() {
23
expect(e.type).toBe('change');
24
}
25
38
- var input = React.render(<input type="checkbox" onChange={cb}/>, container);
39
- console.log(input);
40
- console.log(React.findDOMNode(input));
41
- React.findDOMNode(input).click();
26
+ var input = ReactTestUtils.renderIntoDocument(<input type="checkbox" onChange={cb}/>);
27
+ ReactTestUtils.SimulateNative.click(input);
28
expect(called).toBe(1);
29
});
30
});