mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Scale fixed line heights with text zoom
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import config from "../../../tailwind.config.js";
|
||||
|
||||
const values = new Map();
|
||||
const attributes = new Map();
|
||||
const styleValues = new Map();
|
||||
@@ -25,6 +27,18 @@ globalThis.document = {
|
||||
|
||||
const preference = await import("./fontSizePreference.ts");
|
||||
|
||||
test("scales fixed line-height utilities with the typography rem", () => {
|
||||
assert.deepEqual(config.theme.extend.lineHeight, {
|
||||
3: "calc(var(--buzz-type-rem) * 0.75)",
|
||||
4: "var(--buzz-type-rem)",
|
||||
5: "calc(var(--buzz-type-rem) * 1.25)",
|
||||
6: "calc(var(--buzz-type-rem) * 1.5)",
|
||||
7: "calc(var(--buzz-type-rem) * 1.75)",
|
||||
8: "calc(var(--buzz-type-rem) * 2)",
|
||||
"message-author": "var(--conversation-author-line-height)",
|
||||
});
|
||||
});
|
||||
|
||||
test("defaults invalid and missing font sizes to default", () => {
|
||||
assert.equal(preference.parseFontSize(null), "default");
|
||||
assert.equal(preference.parseFontSize("medium"), "default");
|
||||
|
||||
@@ -33,6 +33,15 @@ export default {
|
||||
],
|
||||
},
|
||||
lineHeight: {
|
||||
// Keep fixed Tailwind line-height utilities in the typography scale so
|
||||
// Cmd +/- cannot enlarge glyphs inside an unchanged line box. Single-
|
||||
// line surfaces keep their existing truncate/overflow behavior.
|
||||
3: "calc(var(--buzz-type-rem) * 0.75)",
|
||||
4: "var(--buzz-type-rem)",
|
||||
5: "calc(var(--buzz-type-rem) * 1.25)",
|
||||
6: "calc(var(--buzz-type-rem) * 1.5)",
|
||||
7: "calc(var(--buzz-type-rem) * 1.75)",
|
||||
8: "calc(var(--buzz-type-rem) * 2)",
|
||||
"message-author": "var(--conversation-author-line-height)",
|
||||
},
|
||||
boxShadow: {
|
||||
|
||||
Reference in New Issue
Block a user