Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/frontend/tests
diff options
context:
space:
mode:
authorLeitwolf112026-10-18 01:45:32 +0300
committerLeitwolf112026-10-18 01:45:32 +0300
commit43c431a793affe2fa41ead816268d6af760f72d0 (patch)
tree7e459be0fa4ac04c126413e405c3939e26cb86bc /frontend/tests
parent7190d8a0911b4cea07cc502a1e471f0889b6d20b (diff)
downloadwebsite-43c431a793affe2fa41ead816268d6af760f72d0.tar.gz
Give each site a calm landing page with a "Why" sectiondesign/landing-pages
tala.run, talac.tala.run and tazel.tala.run now each open on a landing page of their own. talac.tala.run and tazel.tala.run used to redirect "/" to their first documentation topic. Every landing page has one headline, two ways in, a "Why Tala?", "Why Talac?" or "Why Tazel?" section of tabs over one code panel, and a short row of next links. The tabs follow the ARIA tabs pattern: arrow keys, Home and End move between them. The code panel stays left to right on the Hebrew pages and has a copy button. Every sample is something that works today. The Tala tabs show HelloWorld and PrimeNumbers, which are copies of Examples/ (a test compares them), a small program that shows an argument evaluated by need, the LLVM IR that talac -O2 made of the gcd loop of Examples/GCD, and a Tazel project file. The Talac tabs show the terminal output of talac 0.6.0 for one command, --emit=metadata, each --emit stage, the optimized IR and a type error. The Tazel tabs show the project file, the everyday commands, target selection, lock graph and a did-you-mean hint. Of the fifteen programs in Examples/, talac 0.6.0 builds four (HelloWorld, GCD, PrimeNumbers, CollatzTrace), so the classes, generators and pattern matching of the others are not shown yet. The old home page said in nearly every paragraph that the work was unfinished, linked "Why Tala?" three times, and numbered its sections. It is gone. The state of the project is said once, as a small badge beside the name in the header. The header no longer repeats a Home link, since the name leads home. On talac and tazel it lists their documentation topics. Styles that only the old home page used are removed. The titles and descriptions of "/" come from the landing content of each site, and the talac and tazel sitemaps list "/". The tests follow: siteHome is "/" everywhere, the tazel canonical path is "/", and the example comparison reads the landing samples.
Diffstat (limited to 'frontend/tests')
-rw-r--r--frontend/tests/site-integrity.test.mjs35
-rw-r--r--frontend/tests/sites.test.mjs7
2 files changed, 21 insertions, 21 deletions
diff --git a/frontend/tests/site-integrity.test.mjs b/frontend/tests/site-integrity.test.mjs
index 922c03d..51a422b 100644
--- a/frontend/tests/site-integrity.test.mjs
+++ b/frontend/tests/site-integrity.test.mjs
@@ -26,10 +26,12 @@ test("every site publishes exactly its own pages in its sitemap", () => {
"https://tala.run/docs/syntax",
]);
assert.deepEqual(locations("public/hosts/talac/sitemap.xml"), [
+ "https://talac.tala.run/",
"https://talac.tala.run/docs/command-line",
"https://talac.tala.run/docs/outputs",
]);
assert.deepEqual(locations("public/hosts/tazel/sitemap.xml"), [
+ "https://tazel.tala.run/",
"https://tazel.tala.run/docs/commands",
"https://tazel.tala.run/docs/project-file",
]);
@@ -93,7 +95,8 @@ test("the social image is a 1280 by 640 PNG suitable for the page metadata", ()
test("the site has no retired public login or registry links", () => {
const sources = [
"src/App.vue",
- "src/pages/HomePage.vue",
+ "src/pages/LandingPage.vue",
+ "src/content/landing.ts",
"src/pages/OverviewPage.vue",
"src/pages/GettingStartedPage.vue",
];
@@ -122,26 +125,22 @@ test("every linked repository path used by the guides exists when compiler sourc
}
});
-test("the site example is copied from the compiler repository when available", (context) => {
+test("the site examples are copied from the compiler repository when available", async (context) => {
const compilerRoot = join(websiteRoot, "..");
- const examplePath = join(compilerRoot, "Examples/HelloWorld/HelloWorld.tala");
- if (!existsSync(examplePath)) {
+ if (!existsSync(join(compilerRoot, "Examples/HelloWorld/HelloWorld.tala"))) {
context.skip("standalone website checkout has no sibling compiler repository");
return;
}
- const source = readFileSync(examplePath, "utf8");
- const program = source
- .slice(source.indexOf("namespace Examples.HelloWorld;"))
- .replaceAll("\r\n", "\n")
- .trim();
- const pages = ["src/pages/HomePage.vue", "src/pages/GettingStartedPage.vue"];
- for (const page of pages) {
- const content = read(page);
- assert.ok(
- content.replaceAll("\r\n", "\n").includes(program),
- `${page} diverged from the compiler example`,
- );
- }
+ const program = (name) => {
+ const source = readFileSync(join(compilerRoot, `Examples/${name}/${name}.tala`), "utf8");
+ return source.slice(source.indexOf("namespace ")).replaceAll("\r\n", "\n").trim();
+ };
+ const samples = await import("../src/content/landing.ts");
+ assert.equal(samples.helloWorld, program("HelloWorld"), "the HelloWorld tab diverged");
+ assert.equal(samples.primeNumbers, program("PrimeNumbers"), "the PrimeNumbers tab diverged");
+ assert.equal(samples.gcd, program("GCD"), "the GCD sample diverged");
+ const guide = read("src/pages/GettingStartedPage.vue").replaceAll("\r\n", "\n");
+ assert.ok(guide.includes(program("HelloWorld")), "the guide diverged from the compiler example");
});
test("maintenance mode preserves the legacy redirect without opening the language site", () => {
@@ -267,7 +266,7 @@ test("navigation, router, and sitemap agree on the public language pages", () =>
test("every public link in the page shell uses the correct project identity", () => {
const shell = read("src/App.vue");
- const home = read("src/pages/HomePage.vue");
+ const home = read("src/content/landing.ts");
const overview = read("src/pages/OverviewPage.vue");
const guide = read("src/pages/GettingStartedPage.vue");
const combined = [shell, home, overview, guide].join("\n");
diff --git a/frontend/tests/sites.test.mjs b/frontend/tests/sites.test.mjs
index 6999d55..d417dbc 100644
--- a/frontend/tests/sites.test.mjs
+++ b/frontend/tests/sites.test.mjs
@@ -67,8 +67,8 @@ test("every topic a sidebar lists is a page of its site", () => {
assert.ok(sidebar.every((entry) => entry.label.length > 0 && !entry.label.startsWith("/")));
}
}
- assert.equal(siteHome.talac, siteTopics.talac[0]);
- assert.equal(siteHome.tazel, siteTopics.tazel[0]);
+ // Every site opens on its own landing page rather than on a documentation topic.
+ assert.deepEqual(siteHome, { language: "/", talac: "/", tazel: "/" });
});
test("every topic is written in every language with the same code in each", () => {
@@ -134,7 +134,8 @@ test("each site names its pages and points canonical URLs at its own host", () =
assert.equal(talac.title, "Ausgaben · Talac");
assert.equal(talac.canonicalPath, "/docs/outputs");
const tazel = pageMetadata("/", "en-US", "tazel");
- assert.equal(tazel.canonicalPath, "/docs/commands");
+ assert.equal(tazel.canonicalPath, "/");
+ assert.equal(tazel.title, "Tazel — The build system of Tala");
assert.equal(pageMetadata("/docs/syntax", "ru-RU", "language").title, "Синтаксис · Tala");
assert.equal(pageMetadata("/docs/outputs", "en-US", "language").canonicalPath, "/");
assert.deepEqual(siteHosts, {