Fix issue #61: Fix tests
This commit is contained in:
@@ -82,6 +82,9 @@ function loadMapRoutes({ ownsCampaign = true, maps = [], actors = [] } = {}) {
|
||||
: null
|
||||
),
|
||||
},
|
||||
// The map list's own folder tree: `/list` reads it and `/update` checks a move
|
||||
// against it, so the tokens need the model to answer, never what it answers.
|
||||
"../models/Folder": { find: () => mongooseQuery([]), belongsToSection: async () => true },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -188,6 +191,8 @@ function loadActorRoutes({ ownsCampaign = true, actors = [], deletedCount = 1 }
|
||||
return { modifiedCount: 1 };
|
||||
},
|
||||
},
|
||||
// The actor list's own folder tree, which the delete does not ask after.
|
||||
"../models/Folder": { find: () => mongooseQuery([]), belongsToSection: async () => true },
|
||||
});
|
||||
return { api, tokensPulled };
|
||||
}
|
||||
@@ -299,10 +304,14 @@ function mapViewerTokenWiringTests() {
|
||||
const sidebar = readRepoFile("frontend", "app", "components", "partials", "ContentSidebar.vue");
|
||||
|
||||
test("an actor row of the sidebar can be dragged out of it", () => {
|
||||
const actorRow = /<div v-for="actor in actors"[^>]*>/.exec(sidebar)?.[0];
|
||||
// The actors' block of the sidebar: since the entry lists got their folders the rows
|
||||
// come from that tree, so the actor row holds its actor as `row.item`.
|
||||
const actorSection = /<template v-else-if="activeSection === 'actors'">([\s\S]*?)<\/template>\s*\n\s*<template v-else-if="activeSection === 'items'">/
|
||||
.exec(sidebar)?.[1] ?? "";
|
||||
const actorRow = /<div v-else class="entity-entry"[^>]*>/.exec(actorSection)?.[0];
|
||||
assert.ok(actorRow, "expected the actor rows of the sidebar");
|
||||
assert.match(actorRow, /draggable="true"/);
|
||||
assert.match(actorRow, /@dragstart="startActorDrag\(\$event, actor\)"/);
|
||||
assert.match(actorRow, /@dragstart="startActorDrag\(\$event, row\.item\)"/);
|
||||
assert.match(sidebar, /setData\(ACTOR_DRAG_TYPE, String\(actor\._id\)\)/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user