File tree Expand file tree Collapse file tree 3 files changed +210
-147
lines changed
packages/react-dom/src/__tests__ Expand file tree Collapse file tree 3 files changed +210
-147
lines changed Original file line number Diff line number Diff line change @@ -2153,14 +2153,6 @@ dotenv@4.0.0:
21532153 version "4.0.0"
21542154 resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d"
21552155
2156- draft-js@^0.10.5 :
2157- version "0.10.5"
2158- resolved "https://registry.yarnpkg.com/draft-js/-/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742"
2159- dependencies :
2160- fbjs "^0.8.15"
2161- immutable "~3.7.4"
2162- object-assign "^4.1.0"
2163-
21642156duplexer2@^0.1.4 :
21652157 version "0.1.4"
21662158 resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"
@@ -2680,7 +2672,7 @@ fbjs@^0.8.1, fbjs@^0.8.4:
26802672 setimmediate "^1.0.5"
26812673 ua-parser-js "^0.7.9"
26822674
2683- fbjs@^0.8.15, fbjs@^0.8. 16 :
2675+ fbjs@^0.8.16 :
26842676 version "0.8.16"
26852677 resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db"
26862678 dependencies :
@@ -3310,10 +3302,6 @@ ignore@^3.3.3:
33103302 version "3.3.3"
33113303 resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d"
33123304
3313- immutable@~3.7.4 :
3314- version "3.7.6"
3315- resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b"
3316-
33173305imurmurhash@^0.1.4 :
33183306 version "0.1.4"
33193307 resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
Original file line number Diff line number Diff line change @@ -23,34 +23,41 @@ describe('ReactDOM', () => {
2323 ReactTestUtils = require ( 'react-dom/test-utils' ) ;
2424 } ) ;
2525
26- // TODO: uncomment this test once we can run in phantom, which
27- // supports real submit events.
28- /*
2926 it ( 'should bubble onSubmit' , function ( ) {
30- const count = 0;
31- const form;
32- const Parent = React.createClass({
33- handleSubmit: function() {
34- count++;
35- return false;
36- },
37- render: function() {
38- return <Child />;
39- }
40- });
41- const Child = React.createClass({
42- render: function() {
43- return <form><input type="submit" value="Submit" /></form>;
44- },
45- componentDidMount: function() {
46- form = ReactDOM.findDOMNode(this);
47- }
48- });
49- const instance = ReactTestUtils.renderIntoDocument(<Parent />);
50- form.submit();
51- expect(count).toEqual(1);
27+ const container = document . createElement ( 'div' ) ;
28+
29+ let count = 0 ;
30+ let buttonRef ;
31+
32+ function Parent ( ) {
33+ return (
34+ < div
35+ onSubmit = { event => {
36+ event . preventDefault ( ) ;
37+ count ++ ;
38+ } } >
39+ < Child />
40+ </ div >
41+ ) ;
42+ }
43+
44+ function Child ( ) {
45+ return (
46+ < form >
47+ < input type = "submit" ref = { button => ( buttonRef = button ) } />
48+ </ form >
49+ ) ;
50+ }
51+
52+ document . body . appendChild ( container ) ;
53+ try {
54+ ReactDOM . render ( < Parent /> , container ) ;
55+ buttonRef . click ( ) ;
56+ expect ( count ) . toBe ( 1 ) ;
57+ } finally {
58+ document . body . removeChild ( container ) ;
59+ }
5260 } ) ;
53- */
5461
5562 it ( 'allows a DOM element to be used with a string' , ( ) => {
5663 const element = React . createElement ( 'div' , { className : 'foo' } ) ;
You can’t perform that action at this time.
0 commit comments