스타일 수정
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { expectNoPxInStyleObject, expectNoPxInStyleParts } from "./styleInvariants";
|
||||
import {
|
||||
computeTextPbTokens,
|
||||
computeTextEditorTokens,
|
||||
@@ -68,6 +69,17 @@ describe("textHelpers.computeTextPbTokens", () => {
|
||||
expect(prose.maxWidthClass).toBe("pb-text-maxw-prose");
|
||||
expect(narrow.maxWidthClass).toBe("pb-text-maxw-narrow");
|
||||
});
|
||||
|
||||
it("텍스트 Pb inlineStyles 에는 px 단위 값이 포함되지 않아야 한다", () => {
|
||||
const tokens = computeTextPbTokens({
|
||||
...baseProps,
|
||||
colorMode: "custom",
|
||||
colorCustom: "#ff0000",
|
||||
backgroundColorCustom: "#123456",
|
||||
});
|
||||
|
||||
expectNoPxInStyleParts(tokens.inlineStyles);
|
||||
});
|
||||
});
|
||||
|
||||
describe("textHelpers.computeTextEditorTokens", () => {
|
||||
@@ -128,7 +140,7 @@ describe("textHelpers.computeTextPublicTokens", () => {
|
||||
} as TextBlockProps);
|
||||
|
||||
expect(tokens.sizeClass).toBe("");
|
||||
expect(tokens.styleOverrides.fontSize).toBe("24px");
|
||||
expect(tokens.styleOverrides.fontSize).toBe("1.5em");
|
||||
});
|
||||
|
||||
it("colorCustom / backgroundColorCustom 이 styleOverrides 에 반영되어야 한다", () => {
|
||||
@@ -141,4 +153,29 @@ describe("textHelpers.computeTextPublicTokens", () => {
|
||||
expect(tokens.styleOverrides.color).toBe("#ff0000");
|
||||
expect(tokens.styleOverrides.backgroundColor).toBe("#123456");
|
||||
});
|
||||
|
||||
it("lineHeightCustom / letterSpacingCustom \uc774 px \uc778 \uacbd\uc6b0 em \ub2e8\uc704 \uc2a4\ud0c0\uc77c\ub85c \ubcc0\ud658\ub418\uc5b4\uc57c \ud55c\ub2e4", () => {
|
||||
const tokens = computeTextPublicTokens({
|
||||
...baseBlockProps,
|
||||
lineHeightCustom: "24px",
|
||||
letterSpacingCustom: "2px",
|
||||
} as TextBlockProps);
|
||||
|
||||
expect(tokens.styleOverrides.lineHeight).toBe("1.5em");
|
||||
expect(tokens.styleOverrides.letterSpacing).toBe("0.125em");
|
||||
});
|
||||
|
||||
it("퍼블릭 텍스트 styleOverrides 에 px 단위 값이 포함되지 않아야 한다", () => {
|
||||
const tokens = computeTextPublicTokens({
|
||||
...baseBlockProps,
|
||||
fontSizeMode: "custom",
|
||||
fontSizeCustom: "24px",
|
||||
lineHeightCustom: "24px",
|
||||
letterSpacingCustom: "2px",
|
||||
colorCustom: "#ff0000",
|
||||
backgroundColorCustom: "#123456",
|
||||
} as TextBlockProps);
|
||||
|
||||
expectNoPxInStyleObject(tokens.styleOverrides);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user