✨(react) add tokens.ts files handling
These files will be used to define the custom design tokens per components. They are automatically aggregated by the packages/react/cunningham.ts file, this is why handling typescript config file was important.
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { buildTheme, loadTokens } from "tests/Theme";
|
||||
import { Button } from "./index";
|
||||
|
||||
describe("<Button/>", () => {
|
||||
it("renders", () => {
|
||||
render(<Button />);
|
||||
const button = screen.getByRole("button", { name: "<Button/>" });
|
||||
render(<Button>Test button</Button>);
|
||||
const button = screen.getByRole("button", { name: "Test button" });
|
||||
expect(button.classList.contains("c__button")).toBe(true);
|
||||
});
|
||||
|
||||
it("uses custom token", async () => {
|
||||
await buildTheme();
|
||||
const tokens = await loadTokens();
|
||||
expect(tokens.components.button["border-radius"]).toBeDefined();
|
||||
expect(tokens.components.button.shadow).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user