diff --git a/src/core/linter-rules/local-refs-exist.js b/src/core/linter-rules/local-refs-exist.js index 5d2236c6e8..8cb37d5a37 100644 --- a/src/core/linter-rules/local-refs-exist.js +++ b/src/core/linter-rules/local-refs-exist.js @@ -33,8 +33,12 @@ export function run(conf) { const elems = document.querySelectorAll("a[href^='#']"); const offendingElements = [...elems].filter(isBrokenHyperlink); if (offendingElements.length) { + const links = offendingElements + .map(el => el.getAttribute("href")) + .join(", "); + const hint = `${l10n.hint} Broken links: ${links}`; showWarning(l10n.msg, name, { - hint: l10n.hint, + hint, elements: offendingElements, }); } diff --git a/tests/unit/core/linter-rules/local-refs-exist-spec.js b/tests/unit/core/linter-rules/local-refs-exist-spec.js index 94a87728fa..1bcc704678 100644 --- a/tests/unit/core/linter-rules/local-refs-exist-spec.js +++ b/tests/unit/core/linter-rules/local-refs-exist-spec.js @@ -26,6 +26,7 @@ describe("Core Linter Rule - 'local-refs-exist'", () => { const [warning] = warnings; expect(warning.elements).toHaveSize(2); + expect(warning.hint).toContain("#ID-NOT-EXIST"); const [offendingElement] = warning.elements; const { hash } = new URL(offendingElement.href); expect(hash).toBe("#ID-NOT-EXIST");