feat(legal): bilingual (RU + EN) legal pages with a language + theme switcher
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
Add English versions of the privacy policy, EULA and offer (ui/legal/*_en.md) and render each legal page as one self-contained bilingual document: both language bodies plus a header language toggle and theme toggle (no back), a small inline ES5 script that switches language client-side (no reload, default Russian + persisted) and applies the theme (system default + persisted override) — mirroring the landing. The offer's English view transliterates the Russian product names spliced from the live catalog. renderLegalHtml now takes both language sources; renderOffer splices the price list into both; the renderer bakes and reads the _en sources and pre-renders the static pages at boot. Also wrap the /offer/ contour probe in the same retry+timeout as the legal probe (the offer page is now bilingual and larger). Docs + renderer/ui tests updated.
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
// Unit test for the static legal pages: renderPrivacy / renderEula wrap the owner-edited markdown in
|
||||
// the shared legal-page chrome (bundled renderLegalHtml) with the right title + canonical URL and no
|
||||
// dynamic data. The prose rendering itself is unit-tested in ui/ (offer.test.ts); here we assert the
|
||||
// per-page presets.
|
||||
// Unit test for the static legal pages: renderPrivacy / renderEula wrap the owner-edited RU + EN
|
||||
// markdown in the shared bilingual legal-page chrome (bundled renderLegalHtml) with the right title +
|
||||
// canonical URL and no dynamic data. The prose rendering itself is unit-tested in ui/ (offer.test.ts);
|
||||
// here we assert the per-page presets and that both languages reach the document.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { renderPrivacy, renderEula } from '../src/legal.mjs';
|
||||
|
||||
test('renderPrivacy wraps the markdown in the privacy-page chrome', () => {
|
||||
const html = renderPrivacy('# Политика конфиденциальности\n\n**1.1.** ИНН 290210610742.');
|
||||
test('renderPrivacy wraps the RU + EN markdown in the privacy-page chrome', () => {
|
||||
const html = renderPrivacy(
|
||||
'# Политика конфиденциальности\n\n**1.1.** ИНН 290210610742.',
|
||||
'# Privacy Policy\n\n**1.1.** TIN 290210610742.',
|
||||
);
|
||||
assert.ok(html.includes('<!doctype html>'), 'a standalone document');
|
||||
assert.ok(html.includes('<title>Политика конфиденциальности — Эрудит</title>'), 'the privacy title');
|
||||
assert.ok(html.includes('data-title-en="Privacy Policy — Erudit"'), 'the English title for the toggle');
|
||||
assert.ok(html.includes('href="https://erudit-game.ru/privacy/"'), 'the privacy canonical URL');
|
||||
assert.ok(html.includes('290210610742'), 'the prose reached the document');
|
||||
assert.ok(html.includes('<main data-lang="en" hidden>'), 'the English body is present, hidden by default');
|
||||
});
|
||||
|
||||
test('renderEula wraps the markdown in the EULA-page chrome', () => {
|
||||
const html = renderEula('# Лицензионное соглашение\n\nтекст');
|
||||
test('renderEula wraps the RU + EN markdown in the EULA-page chrome', () => {
|
||||
const html = renderEula('# Лицензионное соглашение\n\nтекст', '# Terms of Use\n\ntext');
|
||||
assert.ok(html.includes('<title>Пользовательское соглашение — Эрудит</title>'), 'the EULA title');
|
||||
assert.ok(html.includes('data-title-en="Terms of Use — Erudit"'), 'the English title for the toggle');
|
||||
assert.ok(html.includes('href="https://erudit-game.ru/eula/"'), 'the EULA canonical URL');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user