Image support!
Some checks failed
Test / test (push) Failing after 5s
Build and Deploy Nuxt / build (push) Successful in 1m46s

This commit is contained in:
2026-11-20 19:10:28 +01:00
parent d61659cfdd
commit fe662bb351
11 changed files with 119 additions and 21 deletions

View File

@@ -61,6 +61,14 @@ test("every named note, actor, item and map becomes a suggestion, sorted by labe
]);
});
test("an uploaded file is offered like any other entry, under its name", () => {
const suggestions = autocomplete.BuildLinkSuggestions({
media: [{ _id: "f1", name: "harbour.png" }, { _id: "f2", file: "no-name.png" }],
});
assert.deepEqual(suggestions, [{ id: "f1", label: "harbour.png", type: "media" }]);
});
test("entries without a name are left out, and a repeated label is offered once", () => {
const suggestions = autocomplete.BuildLinkSuggestions({
notes: [{ _id: "n1", title: "The Inn" }, { _id: "n2", title: "The Inn" }, { _id: "n3" }],
@@ -133,18 +141,19 @@ function wiringTests() {
assert.match(note, /@select="applySuggestion"/);
});
test("the entries a note can link to are the campaign's four lists", () => {
for (const path of ["/note/all", "/actor/list", "/item/list", "/map/list"]) {
test("the entries a note can link to are the campaign's lists", () => {
for (const path of ["/note/all", "/actor/list", "/item/list", "/map/list", "/media/list"]) {
assert.ok(targets.includes(path), `the link entries do not read ${path}`);
}
assert.match(targets, /CACHE_TTL/, "the four lists are cached instead of fetched per keystroke");
assert.match(targets, /CACHE_TTL/, "the lists are cached instead of fetched per keystroke");
});
test("the link menu names its section in every locale", () => {
for (const locale of ["en", "es", "ca"]) {
const sections = JSON.parse(readRepoFile("frontend", "i18n", "locales", locale, "campaigns.json")).sections;
for (const type of ["note", "actor", "item", "map"]) {
assert.ok(sections[`${type}s`], `${locale} has no label for the ${type} section`);
for (const type of ["note", "actor", "item", "map", "media"]) {
const key = type === "media" ? "media" : `${type}s`;
assert.ok(sections[key], `${locale} has no label for the ${type} section`);
}
}
});