mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 02:42:28 +00:00
fix(tests): resolve JSDOM errors and tag sorting failures
- Update `tests/video-modal-accessibility.test.mjs` to unconditionally stub `HTMLMediaElement` methods (`pause`, `load`), fixing "Not implemented" errors in JSDOM. - Refactor `VideoModal.normalizeVideoTags` to preserve tag casing while normalizing for deduplication (lowercase + strip #) and ensuring correct display format. - Update `js/ui/components/tagPillList.js` to conditionally prepend `#` only if missing, preventing double-hashing (e.g., `##tag`). - Remove unused `normalizeHashtag` import in `VideoModal.js`. - Verify fixes with `tests/video-modal-tags.test.mjs`. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
91b45abf9a
commit
cf1c81e61e
3 files changed
+21
-25
No files matched your search
@@ -38,7 +38,6 @@ import {
|
||||
formatShortNpub as defaultFormatShortNpub,
|
||||
} from "../../utils/formatters.js";
|
||||
import { sanitizeProfileMediaUrl } from "../../utils/profileMedia.js";
|
||||
import { normalizeHashtag } from "../../utils/hashtagNormalization.js";
|
||||
import { getBreakpointLg } from "../../designSystem/metrics.js";
|
||||
import { LinkPreviewService } from "../../services/linkPreviewService.js";
|
||||
import {
|
||||
@@ -3224,19 +3223,29 @@ export class VideoModal {
|
||||
}
|
||||
|
||||
const raw = typeof entry === "string" ? entry : String(entry ?? "");
|
||||
const trimmed = normalizeHashtag(raw);
|
||||
const trimmed = raw.trim();
|
||||
|
||||
if (!trimmed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const key = trimmed.toLocaleLowerCase();
|
||||
let key = trimmed.toLowerCase();
|
||||
if (key.startsWith("#")) {
|
||||
key = key.slice(1);
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (seen.has(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seen.add(key);
|
||||
normalized.push(trimmed);
|
||||
|
||||
const display = trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
||||
normalized.push(display);
|
||||
}
|
||||
|
||||
return normalized.sort((a, b) =>
|
||||
|
||||
Reference in new issue
Block a user