aboutsummaryrefslogtreecommitdiffstats
path: root/frontend-vanilla/src/main.test.ts
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-17 19:47:48 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-17 19:47:48 -0800
commitd7c1cc00abe7c8097625ee905a1285aa0794a598 (patch)
tree114ae9f7f09222f6881787360ffaa1385a69f834 /frontend-vanilla/src/main.test.ts
parent5c5f440085255bf7f11af589faa4fa14d74f9294 (diff)
downloadneko-d7c1cc00abe7c8097625ee905a1285aa0794a598.tar.gz
neko-d7c1cc00abe7c8097625ee905a1285aa0794a598.tar.bz2
neko-d7c1cc00abe7c8097625ee905a1285aa0794a598.zip
Remove visual 'selected' state highlight from feed items
Diffstat (limited to 'frontend-vanilla/src/main.test.ts')
-rw-r--r--frontend-vanilla/src/main.test.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/frontend-vanilla/src/main.test.ts b/frontend-vanilla/src/main.test.ts
index 7cad61a..2715b5c 100644
--- a/frontend-vanilla/src/main.test.ts
+++ b/frontend-vanilla/src/main.test.ts
@@ -410,16 +410,18 @@ describe('main application logic', () => {
renderLayout();
renderItems();
+ const scrollSpy = vi.spyOn(Element.prototype, 'scrollIntoView');
+
// 1st press 'j' -> index 0
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'j' }));
- expect(document.querySelector('.feed-item[data-id="101"]')?.classList.contains('selected')).toBe(true);
+ expect(scrollSpy).toHaveBeenCalled();
// 2nd press 'j' -> index 1
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'j' }));
- expect(document.querySelector('.feed-item[data-id="102"]')?.classList.contains('selected')).toBe(true);
+ expect(scrollSpy).toHaveBeenCalledTimes(2);
// Press 'k' -> back to index 0
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'k' }));
- expect(document.querySelector('.feed-item[data-id="101"]')?.classList.contains('selected')).toBe(true);
+ expect(scrollSpy).toHaveBeenCalledTimes(3);
});
});