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
Bug fix + tests for pressing escape
event needs to be passed on to the clearValue() method
Tests check that the escape handling is correct 
in the two states (open and closed)
  • Loading branch information
bruderstein committed Jul 27, 2015
commit 1282cb9b47fd41015cac63c31867000e561549c7
22 changes: 22 additions & 0 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ describe('Select', function() {
expect(onChange, 'was called with', 'three');
});

describe('pressing escape', function () {
beforeEach(function () {
typeSearchText('h');
pressTabToAccept();
expect(onChange, 'was called with', 'three');
onChange.reset();
pressEscape();
});

it('should call onChange with a empty value', function () {

// TODO: Shouldn't this be null, really?
expect(onChange, 'was called with', '');
});

it('should clear the display', function () {

expect(React.findDOMNode(instance).querySelector(DISPLAYED_SELECTION_SELECTOR),
'to have text', 'Select...');
});
});

it('should focus the first value on mouse click', function () {

TestUtils.Simulate.mouseDown(React.findDOMNode(instance).querySelector('.Select-control'));
Expand Down