스타일 수정
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { expectNoPxInStyleObject, expectNoPxInStyleParts } from "./styleInvariants";
|
||||
import {
|
||||
computeListExportTokens,
|
||||
computeListEditorTokens,
|
||||
@@ -81,6 +82,17 @@ describe("listHelpers.computeListExportTokens", () => {
|
||||
const tokens = computeListExportTokens({ ...baseProps });
|
||||
expect(tokens.items).toEqual([]);
|
||||
});
|
||||
|
||||
it("Export 리스트 listStyleParts 에는 px 단위 값이 포함되지 않아야 한다", () => {
|
||||
const tokens = computeListExportTokens({
|
||||
...baseProps,
|
||||
align: "center",
|
||||
items: ["a"],
|
||||
backgroundColorCustom: "#123456",
|
||||
});
|
||||
|
||||
expectNoPxInStyleParts(tokens.listStyleParts);
|
||||
});
|
||||
});
|
||||
|
||||
describe("listHelpers.computeListEditorTokens", () => {
|
||||
@@ -158,17 +170,28 @@ describe("listHelpers.computeListPublicTokens", () => {
|
||||
expect(byTokenLg.gapEm).toBe(16 / 16);
|
||||
});
|
||||
|
||||
it("fontSizeCustom 이 px 인 경우 em 단위로 변환되어야 하고, backgroundColorCustom 은 trim 되어야 한다", () => {
|
||||
it("fontSizeCustom / lineHeightCustom 이 px 인 경우 em 단위로 변환되어야 하고, backgroundColorCustom 은 trim 되어야 한다", () => {
|
||||
const tokens = computeListPublicTokens({
|
||||
...baseProps,
|
||||
fontSizeCustom: "32px",
|
||||
lineHeightCustom: "24px",
|
||||
backgroundColorCustom: " #123456 ",
|
||||
});
|
||||
|
||||
expect(tokens.listStyle.fontSize).toBe("2em");
|
||||
expect(tokens.listStyle.lineHeight).toBe("1.5em");
|
||||
expect(tokens.listStyle.backgroundColor).toBe("#123456");
|
||||
});
|
||||
|
||||
it("lineHeightCustom 이 px 인 경우 em 단위로 변환되어야 한다", () => {
|
||||
const tokens = computeListPublicTokens({
|
||||
...baseProps,
|
||||
lineHeightCustom: "24px",
|
||||
});
|
||||
|
||||
expect(tokens.listStyle.lineHeight).toBe("1.5em");
|
||||
});
|
||||
|
||||
it("bulletStyle 은 bulletStyle 지정값 또는 ordered 여부에 따라 결정되어야 한다", () => {
|
||||
const defaultDisc = computeListPublicTokens({ ...baseProps, ordered: false, bulletStyle: undefined });
|
||||
const defaultDecimal = computeListPublicTokens({ ...baseProps, ordered: true, bulletStyle: undefined });
|
||||
@@ -178,4 +201,16 @@ describe("listHelpers.computeListPublicTokens", () => {
|
||||
expect(defaultDecimal.bulletStyle).toBe("decimal");
|
||||
expect(none.bulletStyle).toBe("none");
|
||||
});
|
||||
|
||||
it("퍼블릭 리스트 style 에 px 단위 값이 포함되지 않아야 한다", () => {
|
||||
const tokens = computeListPublicTokens({
|
||||
...baseProps,
|
||||
fontSizeCustom: "32px",
|
||||
lineHeightCustom: "24px",
|
||||
textColorCustom: "#ff0000",
|
||||
backgroundColorCustom: "#123456",
|
||||
});
|
||||
|
||||
expectNoPxInStyleObject(tokens.listStyle);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user