Skip to content

Commit

Permalink
Add history index test
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed May 14, 2024
1 parent e6ec16e commit 5b133f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/__tests__/webInputHistory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ test('history depth', () => {
const history = new InputHistory(depth);
const text = '> Hello _*world*_!';

history.setHistory(testingHistory);
const nextHistoryIndexes = [1, 2, 2];
testingHistory.forEach((item, index) => {
history.add(item.text, item.cursorPosition);
expect(history.historyIndex).toEqual(nextHistoryIndexes[index]);
});

history.add(text, text.length);

const newItem = {text, cursorPosition: text.length};
Expand Down

0 comments on commit 5b133f2

Please sign in to comment.