Skip to content

Commit

Permalink
✅ test element is blurred after focus and enter
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenautjoe committed Apr 8, 2018
1 parent fb3b907 commit 1a5bfb5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/droppable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,22 @@ describe('Droppable', () => {

expect(mockFn).toHaveBeenCalled();
});

it('should call this.element.blur()', () => {
const element = document.createElement('div');
const droppable = new Droppable({
element
});

const mockFn = spyOn(element, 'blur');

droppable['promptForFiles'] = () => {};

const keyDownEvent = new KeyboardEvent('keydown', { keyCode: 13 });
droppable['onElementKeyDown'](keyDownEvent);

expect(mockFn).toHaveBeenCalled();
});
});

describe('when the key is not enter', () => {
Expand Down

0 comments on commit 1a5bfb5

Please sign in to comment.