mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 13:16:16 -08:00
fix(sources): show a new search's first match; keep inconclusive check causes
Local review round 6 (Codex; Greptile was clean at 5/5): - Typing a search or picking a type in the switcher highlighted the first match but kept the list scrolled where the previous result left it, so the highlighted row could sit above the view. The list returns to the top whenever the search or type changes. - A source with no kept history whose check was inconclusive (connection checks paused by the connectivity guard, a cancelled check) lost the live cause and time, and its dot said only "Not verified". The status now keeps them; a running check still reads as checking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a0fc9b924
commit
4e1eb15b90
4 files changed
+45
-1
No files matched your search
+13
@@ -194,6 +194,19 @@ describe('PlaylistSwitcherPanelComponent', () => {
|
||||
expect(closed).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('scrolls a new search back to its first match at the top', () => {
|
||||
const list = (fixture.nativeElement as HTMLElement).querySelector(
|
||||
'.switcher__list'
|
||||
) as HTMLElement;
|
||||
list.scrollTop = 120;
|
||||
type('a');
|
||||
expect(list.scrollTop).toBe(0);
|
||||
|
||||
list.scrollTop = 120;
|
||||
component.setType('xtream');
|
||||
expect(list.scrollTop).toBe(0);
|
||||
});
|
||||
|
||||
it('moves through options whose IDs a selector would misread', () => {
|
||||
const restored = { ...ALPHA, _id: 'odd:id.one', title: 'Aardvark' };
|
||||
playlists.set([restored, BRAVO]);
|
||||
|
||||
+10
@@ -205,11 +205,21 @@ export class PlaylistSwitcherPanelComponent {
|
||||
|
||||
setQuery(value: string): void {
|
||||
this.query.set(value);
|
||||
this.scrollToTop();
|
||||
}
|
||||
|
||||
setType(type: SourcesTypeFilter): void {
|
||||
this.type.set(type);
|
||||
writeSwitcherType(type);
|
||||
this.scrollToTop();
|
||||
}
|
||||
|
||||
/**
|
||||
* A new search or type highlights the first match, at the top of the
|
||||
* list: a list scrolled down for the previous one would hide it.
|
||||
*/
|
||||
private scrollToTop(): void {
|
||||
this.list().nativeElement.scrollTop = 0;
|
||||
}
|
||||
|
||||
onSearchKeydown(event: KeyboardEvent): void {
|
||||
|
||||
@@ -178,6 +178,20 @@ describe('SourceStatusService', () => {
|
||||
expect(service.statusOf(m3u)?.pending).toBe(true);
|
||||
});
|
||||
|
||||
it('says why an inconclusive check is inconclusive', () => {
|
||||
snapshots.set('m', {
|
||||
state: 'unavailable',
|
||||
reason: 'paused',
|
||||
confirmedInactive: false,
|
||||
checkedAt: 700,
|
||||
});
|
||||
expect(create(true).statusOf(m3u)).toEqual({
|
||||
reachability: 'unknown',
|
||||
reason: 'paused',
|
||||
checkedAt: 700,
|
||||
});
|
||||
});
|
||||
|
||||
it('reports an unchecked source as unknown', () => {
|
||||
expect(create(true).statusOf(m3u)).toEqual({
|
||||
reachability: 'unknown',
|
||||
|
||||
@@ -116,7 +116,14 @@ export class SourceStatusService {
|
||||
reason: kept.reason,
|
||||
};
|
||||
}
|
||||
return { reachability };
|
||||
// An inconclusive check still says why ("Connection checks paused").
|
||||
return reachability === 'checking' || !live
|
||||
? { reachability }
|
||||
: {
|
||||
reachability,
|
||||
reason: live.reason,
|
||||
checkedAt: live.checkedAt || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/** A passive check: cached results count; the signal cancels it. */
|
||||
|
||||
Reference in new issue
Block a user