Skip to content

Commit

Permalink
fix(lint): change jest method that breaks the build (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
silviuaavram authored Mar 9, 2019
1 parent 5b721a1 commit dddd76c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions src/__tests__/downshift.get-input-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,21 +584,31 @@ test(`getInputProps doesn't include event handlers when disabled is passed (for
})

test('highlightedIndex is reset to defaultHighlightedIndex when inputValue changes', () => {
const DEFAULT_HIGHLIGHTED_INDEX = 0
const props = {defaultHighlightedIndex: DEFAULT_HIGHLIGHTED_INDEX}
const defaultHighlightedIndex = 0
const {childrenSpy, arrowDownInput, changeInputValue} = renderDownshift({
props,
props: {defaultHighlightedIndex},
})

childrenSpy.mockClear()

arrowDownInput() // highlightedIndex = 1
changeInputValue('r')
expect(childrenSpy).toHaveBeenLastCalledWith(
expect.objectContaining({
highlightedIndex: defaultHighlightedIndex,
}),
)
})

test('highlight should be removed on inputValue change if defaultHighlightedIndex is not provided', () => {
const {childrenSpy, arrowDownInput, changeInputValue} = renderDownshift()

childrenSpy.mockClear()
arrowDownInput() // highlightedIndex = 1
changeInputValue('r')

expect(childrenSpy).toHaveBeenLastCalledWith(
expect.objectContaining({
highlightedIndex: DEFAULT_HIGHLIGHTED_INDEX,
highlightedIndex: null,
}),
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/downshift.misc-with-utils-mocked.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ test('does not scroll from an onMouseMove event', () => {
// now let's make sure that we can still scroll items into view
// ↓
fireEvent.keyDown(input, {key: 'ArrowDown'})
expect(scrollIntoView).toHaveBeenCalled()
expect(scrollIntoView).toHaveBeenCalledWith(item, undefined)
})

0 comments on commit dddd76c

Please sign in to comment.