Skip to content

Commit

Permalink
Merge d0215a1 into 76f942f
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Feb 11, 2020
2 parents 76f942f + d0215a1 commit 5f06075
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/diff/index.js
Expand Up @@ -338,6 +338,11 @@ function diffElementNodes(
dom.innerHTML = (newHtml && newHtml.__html) || '';
}
}

if (newVNode.type === 'select') {
newProps.onChange = newProps.onInput;
newProps.onInput = undefined;
}
}

diffProps(dom, newProps, oldProps, isSvg, isHydrating);
Expand Down
15 changes: 15 additions & 0 deletions test/browser/select.test.js
Expand Up @@ -46,6 +46,21 @@ describe('Select', () => {
expect(scratch.firstChild.value).to.equal('B');
});

it('should alias onInput to onChange', () => {
const func = () => {};
render(
<select onInput={func}>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>,
scratch
);

expect(scratch.firstChild._listeners.change).to.not.be.undefined;
expect(scratch.firstChild._listeners.input).to.be.undefined;
});

it('should work with multiple selected', () => {
function App() {
return (
Expand Down

0 comments on commit 5f06075

Please sign in to comment.