-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…9018) * adding movementX and movementY into syntheticMouseEvent * fixing case mistake * Add test fixture for movementX/Y fields
- Loading branch information
1 parent
9bd4d1f
commit 64c54ed
Showing
5 changed files
with
89 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
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
16 changes: 16 additions & 0 deletions
16
fixtures/dom/src/components/fixtures/mouse-events/index.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,16 @@ | ||
import FixtureSet from '../../FixtureSet'; | ||
import MouseMovement from './mouse-movement'; | ||
|
||
const React = window.React; | ||
|
||
class MouseEvents extends React.Component { | ||
render() { | ||
return ( | ||
<FixtureSet title="Mouse Events" description=""> | ||
<MouseMovement /> | ||
</FixtureSet> | ||
); | ||
} | ||
} | ||
|
||
export default MouseEvents; |
48 changes: 48 additions & 0 deletions
48
fixtures/dom/src/components/fixtures/mouse-events/mouse-movement.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,48 @@ | ||
import TestCase from '../../TestCase'; | ||
|
||
const React = window.React; | ||
|
||
class MouseMovement extends React.Component { | ||
state = { | ||
movement: {x: 0, y: 0}, | ||
}; | ||
|
||
onMove = event => { | ||
this.setState({x: event.movementX, y: event.movementY}); | ||
}; | ||
|
||
render() { | ||
const {x, y} = this.state; | ||
|
||
const boxStyle = { | ||
padding: '10px 20px', | ||
border: '1px solid #d9d9d9', | ||
margin: '10px 0 20px', | ||
}; | ||
|
||
return ( | ||
<TestCase | ||
title="Mouse Movement" | ||
description="We polyfill the movementX and movementY fields." | ||
affectedBrowsers="IE, Safari"> | ||
<TestCase.Steps> | ||
<li>Mouse over the box below</li> | ||
</TestCase.Steps> | ||
|
||
<TestCase.ExpectedResult> | ||
The reported values should equal the pixel (integer) difference | ||
between mouse movements positions. | ||
</TestCase.ExpectedResult> | ||
|
||
<div style={boxStyle} onMouseMove={this.onMove}> | ||
<p>Trace your mouse over this box.</p> | ||
<p> | ||
Last movement: {x},{y} | ||
</p> | ||
</div> | ||
</TestCase> | ||
); | ||
} | ||
} | ||
|
||
export default MouseMovement; |
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