Skip to content

Commit 6fd72ce

Browse files
committed
make onKeyPress work
1 parent c4e3619 commit 6fd72ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/react-dom/src/events/__tests__/SyntheticKeyboardEvent-test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ describe('SyntheticKeyboardEvent', () => {
453453
});
454454

455455
describe('code', () => {
456-
it('returns code on `keydown`, `keyup` and null on `keypress`', () => {
456+
it('returns code on `keydown`, `keyup` and on `keypress`', () => {
457457
let codeDown = null;
458458
let codeUp = null;
459459
let codePress = null;
@@ -488,13 +488,14 @@ describe('SyntheticKeyboardEvent', () => {
488488
node.dispatchEvent(
489489
new KeyboardEvent('keypress', {
490490
code: 'KeyQ',
491+
charCode: 113,
491492
bubbles: true,
492493
cancelable: true,
493494
}),
494495
);
495496
expect(codeDown).toBe('KeyQ');
496497
expect(codeUp).toBe('KeyQ');
497-
expect(codePress).toBe(null);
498+
expect(codePress).toBe('KeyQ');
498499
});
499500
});
500501
});

0 commit comments

Comments
 (0)