fix(addon-search): align navigation and result events with integration tests
- Track navigated index separately from reported highlight index - Report resultIndex -1 when the active match is outside the highlight list - Fix findPrevious buffer search from a saved selection position - Preserve result index when changing search terms with decorations - Fix viewport centering integration test page.evaluate syntax Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Imms
parent
22acf01d43
commit
e60aa4bf97
@@ -79,15 +79,7 @@ test.describe('Search Tests', () => {
|
||||
|
||||
strictEqual(await ctx.page.evaluate(`window.search.findNext('needle-center')`), true);
|
||||
deepStrictEqual(await ctx.proxy.getSelection(), 'needle-center');
|
||||
deepStrictEqual(await ctx.page.evaluate(`
|
||||
const viewportY = window.term.buffer.active.viewportY;
|
||||
const rows = window.term.rows;
|
||||
const selection = window.term.getSelectionPosition();
|
||||
return {
|
||||
viewportY,
|
||||
expectedViewportY: selection.start.y - Math.floor(rows / 2)
|
||||
};
|
||||
`), {
|
||||
deepStrictEqual(await ctx.page.evaluate('(() => { const viewportY = window.term.buffer.active.viewportY; const rows = window.term.rows; const selection = window.term.getSelectionPosition(); return { viewportY: viewportY, expectedViewportY: selection.start.y - Math.floor(rows / 2) }; })()'), {
|
||||
viewportY: 48,
|
||||
expectedViewportY: 48
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user