More things
This commit is contained in:
@@ -16,6 +16,10 @@ const source = fs.readFileSync(
|
||||
path.join(__dirname, "..", "frontend", "app", "components", "partials", "ContentSidebar.vue"),
|
||||
"utf8"
|
||||
);
|
||||
const noteListSource = fs.readFileSync(
|
||||
path.join(__dirname, "..", "frontend", "app", "components", "partials", "NestedNoteList.vue"),
|
||||
"utf8"
|
||||
);
|
||||
|
||||
// `selector` is inserted verbatim, so escape the `.` of a class combination (`entity-entry\\.anchored`).
|
||||
// A trailing `\.entity-entry\s*\{` cannot match `.entity-entry:hover` or `.entity-entry-name`, so the
|
||||
@@ -86,3 +90,22 @@ test("a long entry name wraps instead of pushing the entry out of the sidebar",
|
||||
assert.ok(name, "expected a .entity-entry-name style rule");
|
||||
assert.match(name, /(word-break|overflow-wrap):/, "an unbreakable name has to wrap inside the entry");
|
||||
});
|
||||
|
||||
test("every entity entry leads with the icon of what it is", () => {
|
||||
for (const icon of ["user.svg", "box.svg", "map.svg"]) {
|
||||
assert.match(source, new RegExp(`class="entity-entry-icon"[^>]*${icon.replace('.', '\\.')}`),
|
||||
`expected the ${icon} icon on an entry row`);
|
||||
}
|
||||
// An item that brings its own picture still has the type icon when it carries none.
|
||||
assert.match(source, /v-else class="entity-entry-icon"[^>]*box\.svg/);
|
||||
|
||||
const icon = ruleFor("entity-entry-icon");
|
||||
assert.ok(icon, "expected a .entity-entry-icon style rule");
|
||||
assert.match(declaration(icon, "width"), /^\d+px$/);
|
||||
});
|
||||
|
||||
test("note rows lead with the page icon and media rows with the icon of their type", () => {
|
||||
assert.match(noteListSource, /class="note-link-icon"[^>]*journal-page\.svg/);
|
||||
assert.match(noteListSource, /v-for="item in media"[\s\S]*media-link-icon/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user