Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tests for clicking arrow
Second click closes the options
Right click is ignored
  • Loading branch information
bruderstein committed Jul 27, 2015
commit 2173636c0d31c84ffe42589bfd72bdb7543149d3
15 changes: 15 additions & 0 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,21 @@ describe('Select', function() {
'to have text', 'One');
});

it('should close the options one the second click on the arrow', function () {
var selectArrow = React.findDOMNode(instance).querySelector('.Select-arrow');
TestUtils.Simulate.mouseDown(selectArrow);
expect(React.findDOMNode(instance).querySelectorAll('.Select-option'), 'to have length', 3);

TestUtils.Simulate.mouseDown(selectArrow);
expect(React.findDOMNode(instance).querySelectorAll('.Select-option'), 'to have length', 0);
});

it('should ignore a right mouse click on the arrow', function () {
var selectArrow = React.findDOMNode(instance).querySelector('.Select-arrow');
TestUtils.Simulate.mouseDown(selectArrow, { type: 'mousedown', button: 1 });
expect(React.findDOMNode(instance).querySelectorAll('.Select-option'), 'to have length', 0);
});


describe('after mouseEnter and leave of an option', function () {

Expand Down