diff --git a/docs/releases/unreleased.md b/docs/releases/unreleased.md index 4b894aa5..69d5c5ed 100644 --- a/docs/releases/unreleased.md +++ b/docs/releases/unreleased.md @@ -33,6 +33,8 @@ Example: - (#1964) Fixed Microsoft Calendar OAuth so connecting no longer forces a fresh consent prompt every time, and clarified the Microsoft desktop app setup steps. - Thanks to @thechonta for reporting. +- (#1966) Fixed custom priority icons so they render as icons instead of filled squares on task cards. + - Thanks to @sruiz-savia for reporting. - (#1963) Fixed Google Calendar sync so duplicate event ID fields are repaired when saving task calendar metadata. - Thanks to @christenbc for reporting. - (#1961) Fixed the default custom filename template so it uses the recommended double-brace syntax and no longer warns on first use. diff --git a/styles/task-card-bem.css b/styles/task-card-bem.css index 9ca7a2aa..ad0f41a0 100644 --- a/styles/task-card-bem.css +++ b/styles/task-card-bem.css @@ -1050,6 +1050,10 @@ body.is-mobile .tasknotes-plugin .task-card__context-menu svg { justify-content: center; } +.tasknotes-plugin .task-card[data-priority] > .task-card__main-row .task-card__priority-dot--icon { + background-color: transparent; +} + .tasknotes-plugin .task-card--priority-high > .task-card__main-row .task-card__priority-dot--icon, .tasknotes-plugin .task-card--priority-medium > .task-card__main-row .task-card__priority-dot--icon, .tasknotes-plugin .task-card--priority-normal > .task-card__main-row .task-card__priority-dot--icon, diff --git a/tests/unit/issues/issue-1966-priority-icon-background.test.ts b/tests/unit/issues/issue-1966-priority-icon-background.test.ts new file mode 100644 index 00000000..be3bdfaa --- /dev/null +++ b/tests/unit/issues/issue-1966-priority-icon-background.test.ts @@ -0,0 +1,29 @@ +import fs from "fs"; +import path from "path"; + +function readRepoFile(relativePath: string): string { + return fs.readFileSync(path.resolve(__dirname, "../../../", relativePath), "utf8"); +} + +function extractCssBlock(css: string, selector: string): string { + const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + const match = css.match(new RegExp(`${escapedSelector}\\s*\\{([^}]*)\\}`)); + return match?.[1] ?? ""; +} + +describe("Issue #1966: priority icon backgrounds", () => { + it("keeps priority icon indicators transparent after data-priority color rules", () => { + const css = readRepoFile("styles/task-card-bem.css"); + const colorSelector = + ".tasknotes-plugin .task-card[data-priority] > .task-card__main-row .task-card__priority-dot"; + const iconSelector = + ".tasknotes-plugin .task-card[data-priority] > .task-card__main-row .task-card__priority-dot--icon"; + + const colorRuleIndex = css.indexOf(colorSelector); + const iconRuleIndex = css.indexOf(iconSelector); + + expect(colorRuleIndex).toBeGreaterThanOrEqual(0); + expect(iconRuleIndex).toBeGreaterThan(colorRuleIndex); + expect(extractCssBlock(css, iconSelector)).toContain("background-color: transparent"); + }); +});