chore: adding more styles.test.ts unit tests

This commit is contained in:
TheodorTomas
2026-01-20 23:10:21 +07:00
parent a1364995d1
commit 2fc7827f8e

View File

@@ -327,12 +327,24 @@ describe("addCustomThemeToDom", () => {
expect(variables["--fb-signature-text-color"]).toBeDefined(); // Relies on mixColor & isLight
expect(variables["--fb-branding-text-color"]).toBeDefined(); // Relies on mixColor & isLight
expect(variables["--fb-input-background-color-selected"]).toBeDefined(); // Relies on mixColor
expect(variables["--fb-accent-background-color"]).toBeDefined(); // Relies on mixColor
expect(variables["--fb-accent-background-color-selected"]).toBeDefined(); // Relies on mixColor
// Check accent colors derived from brandColor when not explicitly set
expect(variables["--fb-accent-background-color"]).toBeDefined();
expect(variables["--fb-accent-background-color-selected"]).toBeDefined();
// calendar-tile-color depends on isLight(brandColor)
expect(variables["--fb-calendar-tile-color"]).toBeUndefined(); // isLight('#112233') is false, so this should be undefined
});
test("should generate calendar-tile-color for light brandColor", () => {
const styling = getBaseProjectStyling({ brandColor: { light: "#ffffff" } });
addCustomThemeToDom({ styling });
const styleElement = document.getElementById("formbricks__css__custom") as HTMLStyleElement;
const variables = getCssVariables(styleElement);
expect(variables["--fb-calendar-tile-color"]).toBeDefined();
});
test("should set signature and branding text colors for dark questionColor", () => {
const styling = getBaseProjectStyling({
questionColor: { light: "#202020" }, // A dark color