diff options
| -rw-r--r-- | app/components/Switch.js | 6 | ||||
| -rw-r--r-- | test/components/Switch.spec.js | 8 |
2 files changed, 3 insertions, 11 deletions
diff --git a/app/components/Switch.js b/app/components/Switch.js index 59f997d879..c278cfbd2c 100644 --- a/app/components/Switch.js +++ b/app/components/Switch.js @@ -76,16 +76,12 @@ export default class Switch extends Component { handleChange = (e: Event) => { const startTime = this.state.startTime; - const eventTarget = e.target; + const eventTarget: Object = e.target; if(typeof(startTime) !== 'number') { throw new Error('startTime must be a number.'); } - if(!(eventTarget instanceof HTMLInputElement)) { - throw new Error('e.target must be an instance of HTMLInputElement.'); - } - const dt = e.timeStamp - startTime; if(this.state.ignoreChange) { diff --git a/test/components/Switch.spec.js b/test/components/Switch.spec.js index 78258b1d40..8cdc053c24 100644 --- a/test/components/Switch.spec.js +++ b/test/components/Switch.spec.js @@ -19,9 +19,7 @@ describe('components/Switch', () => { Simulate.mouseDown(domNode, { clientX: 100, clientY: 0 }); Simulate.mouseUp(domNode, { clientX: 100, clientY: 0 }); - - domNode.checked = true; - Simulate.change(domNode); + Simulate.change(domNode, { target: { checked: true } }); }); it('should switch off', (done) => { @@ -36,9 +34,7 @@ describe('components/Switch', () => { Simulate.mouseDown(domNode, { clientX: 100, clientY: 0 }); Simulate.mouseUp(domNode, { clientX: 100, clientY: 0 }); - - domNode.checked = false; - Simulate.change(domNode); + Simulate.change(domNode, { target: { checked: false } }); }); it('should handle left to right swipe', (done) => { |
