tobogganSe connecter

library

Prebuilt pebble components: drop-in custom elements, no compiler needed

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Dernier runAucun
0Étoiles
0Forks
2Issues
43 lignes · 1924 octetsBrut · Historique
1// The prebuilt check: the release bundle, built in a child process (inside
2// `bun test` Bun.build inherits the test runtime's resolutions — see
3// scripts/sizes.ts), written into .size-fixtures (the preload creates it;
4// Bun's resolver cannot see a directory created after startup), then imported
5// with no compiler and no pebble on the consumer's side. It must self-register
6// <pebble-tablet> and enhance a textarea. L3's headless-Chromium smoke carries
7// the real-engine weight; this catches a bundle that only works through the
8// repo's own toolchain.
9import { expect, test } from "bun:test";
10
11const ROOT = `${import.meta.dir}/..`;
12const BUNDLE = `${ROOT}/.size-fixtures/tablet.dist.js`;
13
14const built = Bun.spawnSync(
15 [
16 "bun",
17 "-e",
18 `import { buildRelease } from "./scripts/release.ts";
19 import { writeEntryShim, discoverPackages } from "./scripts/packages.ts";
20 const pkg = (await discoverPackages()).find(p => p.name === "tablet");
21 if (!pkg) throw new Error("packages/tablet not found");
22 await Bun.write(".size-fixtures/tablet.dist.js", await buildRelease(await writeEntryShim(pkg)));`,
23 ],
24 { cwd: ROOT },
25);
26if (built.exitCode !== 0) throw new Error(`fixture build failed:\n${built.stderr.toString()}`);
27
28await import(BUNDLE);
29
30test("the release bundle self-registers and enhances, no compiler involved", () => {
31 const el = document.createElement("pebble-tablet");
32 const field = document.createElement("textarea");
33 field.name = "body";
34 field.value = "vendored";
35 el.appendChild(field);
36 document.body.appendChild(el);
37 // The engine-era surface: the textarea itself, visible and enhanced.
38 expect(el.getAttribute("data-enhanced")).toBe("");
39 expect(field.hidden).toBe(false);
40 expect(field.getAttribute("part")).toBe("editor field");
41 expect((el as unknown as { editor?: { doc: string } }).editor?.doc).toBe("vendored");
42 document.body.textContent = "";
43});