Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/website/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function App({ Component, pageProps, emotionCache = clientSideEmo
const getLayout = Component.getLayout || ((page) => page);
const componentWithLayout = getLayout(<Component {...pageProps} />);
const [filter, setFilter] = useState("");
const { asPath: currentPath } = useRouter();
const { asPath: currentPath, basePath } = useRouter();
const isThemeGenerator = currentPath.includes("/theme-generator");

const matchPaths = (linkPath: string) => {
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function App({ Component, pageProps, emotionCache = clientSideEmo
label: link.label,
icon: link.icon,
items: normalizeNavTabs(link.links),
} as GroupItem;
};
}

return createNavItem(link);
Expand Down Expand Up @@ -106,7 +106,7 @@ export default function App({ Component, pageProps, emotionCache = clientSideEmo
return (
<CacheProvider value={emotionCache}>
<Head>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png" />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon.png`} />
</Head>
<DxcApplicationLayout
logo={{ src: dxcLogo, alt: "DXC Technology" }}
Expand Down
28 changes: 14 additions & 14 deletions apps/website/test/theme-generator/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ describe("theme-generator utils", () => {

describe("generatePalette", () => {
it("should generate palette with 10 colors", () => {
const palette = generatePalette("#FF5733" as CssColor);
const palette = generatePalette("#FF5733");
expect(palette).toHaveLength(10);
});

it("should return array of hex colors", () => {
const palette = generatePalette("#FF5733" as CssColor);
const palette = generatePalette("#FF5733");
palette.forEach((color) => {
expect(color).toMatch(/^#[0-9a-fA-F]{6}$/);
});
Expand All @@ -75,13 +75,13 @@ describe("theme-generator utils", () => {
});

it("should return consistent palette structure", () => {
const palette = generatePalette("#5F249F" as CssColor);
const palette = generatePalette("#5F249F");
expect(palette).toHaveLength(10);
expect(Array.isArray(palette)).toBe(true);
});

it("should return correct values from mocked Leonardo", () => {
const palette = generatePalette("#5F249F" as CssColor);
const palette = generatePalette("#5F249F");
expect(palette[0]).toBe("#fff5f5");
expect(palette[9]).toBe("#ff6565");
});
Expand All @@ -90,9 +90,9 @@ describe("theme-generator utils", () => {
describe("generateTokens", () => {
it("should include base color tokens for all provided colors", () => {
const tokens = generateTokens({
primary: "#111111" as CssColor,
secondary: "#222222" as CssColor,
neutral: "#333333" as CssColor,
primary: "#111111",
secondary: "#222222",
neutral: "#333333",
});

expect(tokens["--color-primary-50"]).toBeDefined();
Expand All @@ -105,8 +105,8 @@ describe("theme-generator utils", () => {

it("should include alpha tokens", () => {
const tokens = generateTokens({
primary: "#111111" as CssColor,
neutral: "#333333" as CssColor,
primary: "#111111",
neutral: "#333333",
});

expect(tokens["--color-alpha-100-a"]).toBeDefined();
Expand All @@ -116,7 +116,7 @@ describe("theme-generator utils", () => {

it("should include absolute color tokens", () => {
const tokens = generateTokens({
primary: "#111111" as CssColor,
primary: "#111111",
});

expect(tokens["--color-absolutes-black"]).toBe("#000000");
Expand All @@ -125,7 +125,7 @@ describe("theme-generator utils", () => {

it("should generate correct alpha values with opacity", () => {
const tokens = generateTokens({
neutral: "#999999" as CssColor,
neutral: "#999999",
});

expect(tokens["--color-alpha-100-a"]).toMatch(/^#[0-9a-fA-F]{6}1a$/);
Expand All @@ -134,7 +134,7 @@ describe("theme-generator utils", () => {

it("should handle single color input", () => {
const tokens = generateTokens({
primary: "#FF5733" as CssColor,
primary: "#FF5733",
});

expect(Object.keys(tokens).length).toBeGreaterThan(0);
Expand All @@ -143,15 +143,15 @@ describe("theme-generator utils", () => {

it("should convert color names to lowercase in tokens", () => {
const tokens = generateTokens({
Primary: "#FF5733" as CssColor,
Primary: "#FF5733",
});

expect(tokens["--color-primary-50"]).toBeDefined();
});

it("should use default neutral color if not provided", () => {
const tokens = generateTokens({
primary: "#FF5733" as CssColor,
primary: "#FF5733",
});

// Alpha tokens should still be generated with default neutral
Expand Down
Loading