mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 06:06:18 -08:00
fix(sources): sort by the shown name; start the benchmark's Undo window in its trigger
Local review round 3 (Greptile; Codex was clean): - Name order compared the stored title, while the rows show a URL-named or credential-bearing source by its host: a source stored as get.php?username=… sorted by its hidden account details. sortPlaylists takes the list's name function, and Sources and the switcher pass sourceSortName, the name they display. - The Xtream delete benchmark clicked Remove while preparing, which starts the four-second Undo window; capture setup before the trigger could outlast it, so the delete committed on its own before the measurement and the close button was gone. Preparation now stops at the open menu, and the trigger clicks Remove and then the toast's close button, with the trigger time taken right before the commit click as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
123bc170e9
commit
85e6cb3816
10 files changed
+102
-10
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
sourceCopyUrl,
|
||||
sourceDisplayName,
|
||||
sourceSortName,
|
||||
sourceDisplayUrl,
|
||||
sourceHost,
|
||||
} from './source-display';
|
||||
@@ -83,6 +84,15 @@ describe('sourceDisplayName', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('sourceSortName', () => {
|
||||
it('sorts a source by the name it shows', () => {
|
||||
expect(sourceSortName({ title: 'get.php?x=1', url: M3U_URL })).toBe(
|
||||
sourceDisplayName({ title: 'get.php?x=1', url: M3U_URL })
|
||||
);
|
||||
expect(sourceSortName({ title: '' })).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('sourceDisplayUrl', () => {
|
||||
it('shows an M3U URL without credentials', () => {
|
||||
expect(sourceDisplayUrl({ url: M3U_URL })).toBe(
|
||||
|
||||
@@ -135,6 +135,11 @@ export function sourceDisplayName(
|
||||
return containsSourceSecret(raw, playlist) ? host : raw;
|
||||
}
|
||||
|
||||
/** The name a list shows and sorts a source by; empty when it has none. */
|
||||
export function sourceSortName(playlist: SourceDisplayFields): string {
|
||||
return sourceDisplayName(playlist) ?? '';
|
||||
}
|
||||
|
||||
/** `origin/…/last` once a path has more than two segments. */
|
||||
function compactPath(pathname: string): string {
|
||||
const segments = pathname.split('/').filter(Boolean);
|
||||
|
||||
Reference in new issue
Block a user