Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pages/_survey.astro
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ const tt = useT(lang).survey;
<div class="container">
<div class="swrap">
<p class="eyebrow">{tt.kicker}</p>
<h1>{tt.titleA} <span class="hl">{tt.titleB}</span></h1>
{/* El espacio va explícito: Astro se come el que hay entre una
expresión y la etiqueta siguiente, y las dos líneas del
titular quedaban pegadas ("from" + "the NaN builders"). */}
<h1>{tt.titleA}{' '}<span class="hl">{tt.titleB}</span></h1>
<p class="shero__lead">{tt.lead}</p>
<div class="sstats">
{tt.stats.map((s) => (
Expand Down
29 changes: 29 additions & 0 deletions src/tests/landing/surveyData.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { describe, expect, test } from 'vitest';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import encuesta from '../../data/encuesta.json';
import { loc, type Localized } from '../../lib/agenda';
import { useT } from '../../lib/i18n';
Expand Down Expand Up @@ -194,6 +197,32 @@ describe('nada de datos personales en toda la página', () => {
});
});

describe('el titular de la portada', () => {
const here = dirname(fileURLToPath(import.meta.url));
const page = readFileSync(resolve(here, '../../pages/_survey.astro'), 'utf-8');
const h1 = page.slice(page.indexOf('<h1>'), page.indexOf('</h1>'));

/**
* Salió a producción con las dos mitades pegadas: "The answers from" y "the
* NaN builders" se leían como "fromthe". Astro se come el espacio que hay
* entre una expresión y la etiqueta siguiente, así que tiene que ir
* explícito, como en /projects.
*/
test('el espacio entre las dos mitades va explícito', () => {
expect(h1).toContain("{' '}");
});

test('las dos mitades del titular existen en los dos idiomas y no traen espacios de más', () => {
for (const lang of LANGS) {
const s = useT(lang).survey;
for (const half of [s.titleA, s.titleB]) {
expect(half).toBe(half.trim());
expect(half).not.toBe('');
}
}
});
});

describe('el chrome de la página está en el diccionario', () => {
test('las dos pestañas, la cabecera y el método existen en los dos idiomas', () => {
for (const lang of LANGS) {
Expand Down
Loading