mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
feat: rebuild desktop sync as linked server accounts, fix packaged plugin bundles and UI scaling
This commit is contained in:
1 parent
7c02daccf4
commit
6cd9a2846d
242 files changed
+39127
-8558
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { createRequire } from "node:module";
|
||||
import postcss from "postcss";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const config = require("../postcss.config.cjs") as {
|
||||
plugins: Record<string, unknown>;
|
||||
};
|
||||
const pxtorem = require("postcss-pxtorem");
|
||||
|
||||
async function convert(css: string, from = "src/ui/index.css") {
|
||||
const result = await postcss([
|
||||
pxtorem(config.plugins["postcss-pxtorem"]),
|
||||
]).process(css, { from });
|
||||
return result.css;
|
||||
}
|
||||
|
||||
describe("interface size conversion", () => {
|
||||
it("turns px into rem against the 14px Normal root", async () => {
|
||||
expect(await convert(".a{font-size:10px;width:280px}")).toBe(
|
||||
".a{font-size:0.71429rem;width:20rem}",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps hairlines, breakpoints and the root size rules in px", async () => {
|
||||
expect(await convert(".b{border-width:1px}")).toBe(".b{border-width:1px}");
|
||||
expect(await convert("@media (min-width:768px){.c{gap:7px}}")).toBe(
|
||||
"@media (min-width:768px){.c{gap:0.5rem}}",
|
||||
);
|
||||
expect(await convert("html.fs-lg{font-size:17px}")).toBe(
|
||||
"html.fs-lg{font-size:17px}",
|
||||
);
|
||||
});
|
||||
|
||||
it("leaves third-party CSS alone", async () => {
|
||||
expect(
|
||||
await convert(
|
||||
".xterm{padding:4px}",
|
||||
"node_modules/@xterm/xterm/css/xterm.css",
|
||||
),
|
||||
).toBe(".xterm{padding:4px}");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user