mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1538164 - [release 130] 8118/fix quick open modal nan bug (#8136).
Differential Revision: https://phabricator.services.mozilla.com/D24774 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
83fa0aa6cc
commit
062fce54c0
@ -235,7 +235,7 @@ export class QuickOpenModal extends Component<Props, State> {
|
||||
const { selectedIndex, results } = this.state;
|
||||
const resultCount = this.getResultCount();
|
||||
const index = selectedIndex + direction;
|
||||
const nextIndex = (index + resultCount) % resultCount;
|
||||
const nextIndex = (index + resultCount) % resultCount || 0;
|
||||
|
||||
this.setState({ selectedIndex: nextIndex });
|
||||
|
||||
|
@ -636,7 +636,7 @@ describe("QuickOpenModal", () => {
|
||||
}));
|
||||
wrapper.find("SearchInput").simulate("keydown", event);
|
||||
expect(event.preventDefault).toHaveBeenCalled();
|
||||
expect(wrapper.state().selectedIndex).toEqual(NaN);
|
||||
expect(wrapper.state().selectedIndex).toEqual(0);
|
||||
expect(props.selectSpecificLocation).not.toHaveBeenCalledWith();
|
||||
expect(props.highlightLineRange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user