Skip to content

Commit

Permalink
Test coverage for toggling values in multi-select
Browse files Browse the repository at this point in the history
  • Loading branch information
banderson committed Jul 30, 2017
1 parent 3d88a77 commit 3779f38
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ describe('Select', () => {

});

describe('with removeSelected=true', () => {
describe('with removeSelected=false', () => {
beforeEach(() => {
options = [
{ value: 'one', label: 'One' },
Expand Down Expand Up @@ -2125,6 +2125,26 @@ describe('Select', () => {
],
]);
});

it('removes a selected value if chosen again', () => {

clickArrowToOpen();

var items = ReactDOM.findDOMNode(instance).querySelectorAll('.Select-option');

// Click the option "Two" to select it
TestUtils.Simulate.mouseDown(items[1]);
expect(onChange, 'was called times', 1);

// Click the option "Two" again to deselect it
TestUtils.Simulate.mouseDown(items[1]);
expect(onChange, 'was called times', 2);

expect(onChange.args, 'to equal', [
[[{ value: 'two', label: 'Two' }]],
[[]],
]);
});
});

describe('with props', () => {
Expand Down

0 comments on commit 3779f38

Please sign in to comment.