diff --git a/src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js b/src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js index b0724a92b3bc9..06fe96f026800 100644 --- a/src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js +++ b/src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js @@ -362,6 +362,7 @@ var ChangeEventPlugin = { targetID, nativeEvent ); + event.type = 'change'; EventPropagators.accumulateTwoPhaseDispatches(event); return event; } diff --git a/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js new file mode 100644 index 0000000000000..3d00cac832827 --- /dev/null +++ b/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js @@ -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(); + ReactTestUtils.SimulateNative.click(input); + expect(called).toBe(1); + }); +});