forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request facebook#4206 from yiminghe/fix_change_type
Set change event type in SyntheticEvent
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js
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,30 @@ | ||
/** | ||
* Copyright 2013-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var React = require('React'); | ||
var ReactTestUtils = require('ReactTestUtils'); | ||
|
||
describe('ChangeEventPlugin', function() { | ||
it('should fire change for checkbox input', function() { | ||
var called = 0; | ||
|
||
function cb(e) { | ||
called = 1; | ||
expect(e.type).toBe('change'); | ||
} | ||
|
||
var input = ReactTestUtils.renderIntoDocument(<input type="checkbox" onChange={cb}/>); | ||
ReactTestUtils.SimulateNative.click(input); | ||
expect(called).toBe(1); | ||
}); | ||
}); |