Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
jooj123 committed Sep 4, 2016
1 parent 5001083 commit 9267932
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3324,24 +3324,29 @@ describe('Select', () => {
});
});

describe('clicking outside', () => {
describe('outside event', () => {

beforeEach(() => {

instance = createControl({
options: defaultOptions
});
});

it('closes the menu', () => {

TestUtils.Simulate.mouseDown(getSelectControl(instance), { button: 0 });
expect(ReactDOM.findDOMNode(instance), 'queried for', '.Select-option',
'to have length', 4);
});

it('click closes the menu', () => {
TestUtils.Simulate.blur(searchInputNode);
expect(ReactDOM.findDOMNode(instance), 'to contain no elements matching', '.Select-option');
});

it('touch closes the menu', () => {
const evt = document.createEvent('Event');
evt.initEvent('touchstart', true, true);
document.querySelector('body').dispatchEvent(evt);
expect(ReactDOM.findDOMNode(instance), 'to contain no elements matching', '.Select-option');
});

});

describe('with autosize=false', () => {
Expand Down

0 comments on commit 9267932

Please sign in to comment.