Skip to content

Commit

Permalink
Change tests to match new behaviour - #243
Browse files Browse the repository at this point in the history
Menu is closed after a selection is clicked from PR #243 (fix for issue #211)
Tests changed to re-open menu when selecting multiple items via mouse
  • Loading branch information
bruderstein committed Aug 12, 2015
1 parent c6b356d commit 023a527
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,8 @@ describe('Select', function() {

var items = React.findDOMNode(instance).querySelectorAll('.Select-option');
TestUtils.Simulate.mouseDown(items[1]);
// The menu is now closed, click the arrow to open it again
clickArrowToOpen();
items = React.findDOMNode(instance).querySelectorAll('.Select-option');
TestUtils.Simulate.mouseDown(items[0]);

Expand All @@ -1445,6 +1447,9 @@ describe('Select', function() {
expect(onChange, 'was called with', 'two', [{ value: 'two', label: 'Two' }]);

// Second item

// The menu is now closed, click the arrow to open it again
clickArrowToOpen();
items = React.findDOMNode(instance).querySelectorAll('.Select-option');
TestUtils.Simulate.mouseDown(items[0]);
expect(onChange, 'was called twice');
Expand All @@ -1462,6 +1467,8 @@ describe('Select', function() {
expect(onChange, 'was called times', 1);

// Now get the list again,
// The menu is now closed, click the arrow to open it again
clickArrowToOpen();
items = React.findDOMNode(instance).querySelectorAll('.Select-option');
expect(items[0], 'to have text', 'One');
expect(items[1], 'to have text', 'Three');
Expand All @@ -1472,6 +1479,8 @@ describe('Select', function() {
TestUtils.Simulate.mouseDown(items[0]);

expect(onChange, 'was called times', 2);
// The menu is now closed, click the arrow to open it again
clickArrowToOpen();
items = React.findDOMNode(instance).querySelectorAll('.Select-option');
expect(items[0], 'to have text', 'Three');
expect(items[1], 'to have text', 'Four');
Expand All @@ -1481,6 +1490,8 @@ describe('Select', function() {
TestUtils.Simulate.mouseDown(items[1]);
expect(onChange, 'was called times', 3);

// The menu is now closed, click the arrow to open it again
clickArrowToOpen();
items = React.findDOMNode(instance).querySelectorAll('.Select-option');
expect(items[0], 'to have text', 'Three');
expect(items, 'to have length', 1);
Expand Down

0 comments on commit 023a527

Please sign in to comment.