feat(nav): route Service Card 2 and nav link to /kundalini/

- `src/partials/header.html`: add `Kundalini Yoga` (`/kundalini/`, `data-nav-current="kundalini"`) link between `/#servicios` and `/#otros-espacios`
- `index.html`: route Service Card 2 CTA in-tab to `/kundalini/` instead of `wa.me`
- `AGENTS.md`: document `/kundalini/` routing and temporary Spanish-only routes ahead of Slice 5
- `tests/html-partials.test.js` & `tests/services-catalog.test.js`: update contract tests for `/kundalini/` nav link, `aria-current="page"` mapping, and Card 2 route
This commit is contained in:
kiskaadee committed 2026-11-30 04:48:50 -05:00
1 parent a340121acc
commit 3f39cc770c
5 files changed
+147 -24

No files matched your search

+3 -3
View File
@@ -8,8 +8,8 @@ project_number: 1
``` ```
## Rules for working in this repo ## Rules for working in this repo
- **Acceptance criteria:** Implement strictly against [`docs/specs/landing-page-brief.md`](./docs/specs/landing-page-brief.md). Never invent service copy, pricing, schedules, or contact numbers. - **Acceptance criteria:** Implement strictly against [`docs/specs/landing-page-brief.md`](./docs/specs/landing-page-brief.md) and, for the `/kundalini/`, `/volver-a-ti/`, and `/descargo/` routes, [`docs/specs/kundalini-volver-a-ti-design.md`](./docs/specs/kundalini-volver-a-ti-design.md). Never invent service copy, pricing, schedules, or contact numbers.
- **Static-first v1:** Zero backend, database, authentication, payment, or scheduling API dependencies. - **Static-first v1:** Zero backend, database, authentication, payment, or scheduling API dependencies.
- **Direct conversion:** All primary and per-service CTAs route directly to WhatsApp (`wa.me`) with URL-encoded pre-filled inquiry text. - **Direct conversion:** All primary and per-service CTAs route directly to WhatsApp (`wa.me`) with URL-encoded pre-filled inquiry text, except Service Card 2 (Kundalini Yoga), which routes in-tab to the `/kundalini/` hub. The hub and program pages keep their WhatsApp/payment CTAs per [`docs/specs/kundalini-volver-a-ti-design.md`](./docs/specs/kundalini-volver-a-ti-design.md).
- **Visual & a11y baseline:** Mobile-first (`375px` to `1440px`), WCAG AA contrast (`>= 4.5:1`), zero console errors, and grounded warm-neutral styling per approved brand assets (never pull raw/unapproved files from workspace `.internal/`). - **Visual & a11y baseline:** Mobile-first (`375px` to `1440px`), WCAG AA contrast (`>= 4.5:1`), zero console errors, and grounded warm-neutral styling per approved brand assets (never pull raw/unapproved files from workspace `.internal/`).
- **Bilingual parity invariant (multi-page static):** Prior to adopting a component compiler or templating layer, any structural, CSS class, asset, or design token change applied to `index.html` (Spanish default) must be mirrored with identical structural parity in `en/index.html` (English), maintaining localized copy, reciprocal `hreflang` tags, and language-specific WhatsApp inquiry strings. - **Bilingual parity invariant (multi-page static):** Shared header, footer, and WhatsApp FAB live in build-time partials (`src/partials/*`, injected by `scripts/html-partials-plugin.ts`); edit them there, not inline. Any other structural, CSS class, asset, or design token change applied to `index.html` (Spanish default) must be mirrored with identical structural parity in `en/index.html` (English), maintaining localized copy, reciprocal `hreflang` tags, and language-specific WhatsApp inquiry strings. Exception: `/kundalini/`, `/volver-a-ti/`, and `/descargo/` are temporarily Spanish-only until Milestone 1 Slice 5 ([`ROADMAP.md`](../ROADMAP.md)); no `en/` mirrors are required for them yet.
+2 -4
View File
@@ -151,12 +151,10 @@
</p> </p>
</div> </div>
<a <a
href="https://wa.me/573215428972?text=Hola%20Azu,%20me%20gustar%C3%ADa%20consultar%20sobre%20las%20Clases%20de%20Kundalini%20Yoga%20y%20Acompa%C3%B1amientos." href="/kundalini/"
target="_blank"
rel="noopener noreferrer"
class="block w-full rounded-full border border-emerald px-6 py-3 text-center text-sm font-semibold text-emerald transition hover:bg-emerald hover:text-ivory" class="block w-full rounded-full border border-emerald px-6 py-3 text-center text-sm font-semibold text-emerald transition hover:bg-emerald hover:text-ivory"
> >
Consultar Kundalini Yoga → Explorar Kundalini Yoga →
</a> </a>
</div> </div>
+1
View File
@@ -23,6 +23,7 @@
<!-- Why: a single nav tree keeps screen-reader and visual order aligned at every breakpoint. --> <!-- Why: a single nav tree keeps screen-reader and visual order aligned at every breakpoint. -->
<ul id="site-menu" class="hidden absolute inset-x-0 top-full z-40 flex-col space-y-4 border-b border-sage/30 bg-ivory/95 px-6 py-5 text-sm font-medium text-forest shadow-lg backdrop-blur-md lg:static lg:flex lg:flex-row lg:items-center lg:gap-8 lg:space-y-0 lg:border-b-0 lg:bg-transparent lg:p-0 lg:shadow-none"> <ul id="site-menu" class="hidden absolute inset-x-0 top-full z-40 flex-col space-y-4 border-b border-sage/30 bg-ivory/95 px-6 py-5 text-sm font-medium text-forest shadow-lg backdrop-blur-md lg:static lg:flex lg:flex-row lg:items-center lg:gap-8 lg:space-y-0 lg:border-b-0 lg:bg-transparent lg:p-0 lg:shadow-none">
<li><a href="/#servicios" class="block transition hover:text-emerald">Servicios</a></li> <li><a href="/#servicios" class="block transition hover:text-emerald">Servicios</a></li>
<li><a href="/kundalini/" data-nav-current="kundalini" class="block transition hover:text-emerald">Kundalini Yoga</a></li>
<li><a href="/#otros-espacios" class="block transition hover:text-emerald">Otros Espacios</a></li> <li><a href="/#otros-espacios" class="block transition hover:text-emerald">Otros Espacios</a></li>
<li><a href="/#acerca" class="block transition hover:text-emerald">Acerca de Azu</a></li> <li><a href="/#acerca" class="block transition hover:text-emerald">Acerca de Azu</a></li>
<li><a href="/#filosofia" class="block transition hover:text-emerald">Filosofía</a></li> <li><a href="/#filosofia" class="block transition hover:text-emerald">Filosofía</a></li>
+87 -14
View File
@@ -88,14 +88,42 @@ test('Issue #5 Acceptance Criteria: built partials, navigation and metadata', as
} }
}); });
await t.test('Criterion 2: built header does not expose a /kundalini/ nav link yet', () => { await t.test(
const headerMarkup = extractHeaderMarkup(distHtml); 'Issue #6: built header exposes a "Kundalini Yoga" link to /kundalini/ between Servicios and Otros Espacios',
() => {
const headerMarkup = extractHeaderMarkup(distHtml);
const kundaliniLink = headerMarkup.match(
/<a\b[^>]*\bhref="\/kundalini\/"[^>]*>([\s\S]*?)<\/a>/i,
);
assert.ok(kundaliniLink, 'Built header must contain a link with href="/kundalini/"');
assert.match(
kundaliniLink[1].replace(/<[^>]*>/g, ' '),
/Kundalini Yoga/,
'The /kundalini/ header link must be labelled "Kundalini Yoga"',
);
// Why: /kundalini/ belongs to a later issue; this slice only wires the existing sections. // Why: spec places the route link right after Servicios so the nav mirrors page order.
const serviciosIndex = headerMarkup.indexOf('href="/#servicios"');
const kundaliniIndex = headerMarkup.indexOf('href="/kundalini/"');
const otrosIndex = headerMarkup.indexOf('href="/#otros-espacios"');
assert.ok(
serviciosIndex !== -1 && serviciosIndex < kundaliniIndex && kundaliniIndex < otrosIndex,
'The /kundalini/ link must sit between /#servicios and /#otros-espacios',
);
},
);
await t.test('Issue #6: /kundalini/ header link is not aria-current on the home route', () => {
const headerMarkup = extractHeaderMarkup(distHtml);
const kundaliniTag = [...headerMarkup.matchAll(/<a\b[^>]*>/gi)]
.map((match) => match[0])
.find((tag) => /\bhref="\/kundalini\/"/i.test(tag));
assert.ok(kundaliniTag, 'Built header must contain a link with href="/kundalini/"');
// Why: on "/" only the brand link is current; a second current item would mislead AT users.
assert.doesNotMatch( assert.doesNotMatch(
headerMarkup, kundaliniTag,
/href="\/kundalini\//i, /\baria-current=/i,
'Built header must not expose a /kundalini/ nav link yet', 'The /kundalini/ link must not carry aria-current on the home route',
); );
}); });
@@ -236,21 +264,23 @@ test('Issue #5 Acceptance Criteria: built partials, navigation and metadata', as
); );
}); });
await t.test('Criterion 4: Kundalini service card keeps its live wa.me CTA', () => { await t.test('Issue #6: Kundalini service card CTA opens /kundalini/ in the same tab', () => {
const kundaliniCard = extractCardByHeading( const kundaliniCard = extractCardByHeading(
distHtml, distHtml,
'Clases de Kundalini Yoga y Acompañamientos', 'Clases de Kundalini Yoga y Acompañamientos',
); );
assert.ok(kundaliniCard, 'Service Card 2 (Kundalini Yoga) must exist in built HTML'); assert.ok(kundaliniCard, 'Service Card 2 (Kundalini Yoga) must exist in built HTML');
assert.match( const ctaTag = [...kundaliniCard.matchAll(/<a\b[^>]*>/gi)]
kundaliniCard, .map((match) => match[0])
/href="https:\/\/wa\.me\/573215428972\?text=[^"]*Kundalini/i, .find((tag) => /\bhref="\/kundalini\/"/i.test(tag));
'Service Card 2 must keep its live wa.me inquiry link in this issue', assert.ok(ctaTag, 'Service Card 2 must link to the internal /kundalini/ route');
); // Why: an internal route is same-site navigation; new-tab attributes are only for external links.
assert.doesNotMatch(ctaTag, /\btarget=/i, 'The /kundalini/ card CTA must open in-tab');
assert.doesNotMatch(ctaTag, /\brel=/i, 'The /kundalini/ card CTA must not carry rel');
assert.doesNotMatch( assert.doesNotMatch(
kundaliniCard, kundaliniCard,
/href="\/kundalini\//i, /href="https:\/\/wa\.me\//i,
'A local /kundalini/ card link belongs to a later issue', 'Service Card 2 must no longer carry a direct wa.me CTA',
); );
}); });
}); });
@@ -333,4 +363,47 @@ test('html-partials-plugin unit behavior', async (t) => {
assert.doesNotMatch(result, /\bdata-nav-current\b/i); assert.doesNotMatch(result, /\bdata-nav-current\b/i);
}, },
); );
// Why: these exercise the real header partial (not a synthetic sample) so the
// partial's data-nav-current hints and the plugin's route map stay in sync.
const realHeaderHtml = '<!-- @include src/partials/header.html -->';
function transformRealHeaderFor(routeFile) {
const plugin = htmlPartialsPlugin();
plugin.configResolved?.({ root: process.cwd() });
return plugin.transformIndexHtml.handler(realHeaderHtml, {
path: '/index.html',
filename: path.resolve(routeFile),
});
}
function anchorTagByHref(html, href) {
return [...html.matchAll(/<a\b[^>]*>/gi)]
.map((match) => match[0])
.find((tag) => tag.includes(`href="${href}"`));
}
await t.test(
'real header partial marks /kundalini/ link aria-current on kundalini/index.html build',
() => {
const result = transformRealHeaderFor('kundalini/index.html');
const kundaliniTag = anchorTagByHref(result, '/kundalini/');
assert.ok(kundaliniTag, 'Header partial must contain a href="/kundalini/" link');
assert.match(kundaliniTag, /\baria-current="page"/i);
assert.doesNotMatch(anchorTagByHref(result, '/') ?? '', /\baria-current=/i);
},
);
for (const routeFile of ['volver-a-ti/index.html', 'descargo/index.html']) {
await t.test(`real header partial sets no aria-current on ${routeFile} build`, () => {
const result = transformRealHeaderFor(routeFile);
assert.ok(
anchorTagByHref(result, '/kundalini/'),
'Header partial must contain a href="/kundalini/" link',
);
// Why: these routes have no nav entry, so no item may claim to be current.
assert.doesNotMatch(result, /\baria-current=/i);
assert.doesNotMatch(result, /\bdata-nav-current\b/i);
});
}
}); });
+54 -3
View File
@@ -11,6 +11,40 @@ const indexHtml = fs.readFileSync(indexPath, 'utf-8');
const cssPath = path.resolve('src/style.css'); const cssPath = path.resolve('src/style.css');
const styleCss = fs.readFileSync(cssPath, 'utf-8'); const styleCss = fs.readFileSync(cssPath, 'utf-8');
/**
* Locate a service card by its <h3> heading and return its enclosing card <div>.
* Why: avoids coupling tests to HTML comments that minification may strip.
*/
function extractCardByHeading(html, headingText) {
const headingMatch = new RegExp(`<h3\\b[^>]*>[^<]*${headingText}[^<]*</h3>`, 'i').exec(html);
if (!headingMatch) {
return undefined;
}
let cardStart = -1;
for (const match of html.matchAll(/<div\b[^>]*class="[^"]*\brounded-2xl\b[^"]*"[^>]*>/gi)) {
if (match.index > headingMatch.index) {
break;
}
cardStart = match.index;
}
if (cardStart === -1) {
return undefined;
}
let depth = 0;
for (const tagMatch of html.matchAll(/<\/?div\b[^>]*>/gi)) {
if (tagMatch.index < cardStart) {
continue;
}
depth += tagMatch[0].startsWith('</') ? -1 : 1;
if (depth === 0) {
return html.slice(cardStart, tagMatch.index + tagMatch[0].length);
}
}
return undefined;
}
test('Slice 3 Acceptance Criteria: 5-Card Catalog, Brand Tokens & Complementary Paths', async (t) => { test('Slice 3 Acceptance Criteria: 5-Card Catalog, Brand Tokens & Complementary Paths', async (t) => {
await t.test( await t.test(
'Criterion 1: Brand System Integrity (Google Fonts loaded, Tailwind @theme color tokens)', 'Criterion 1: Brand System Integrity (Google Fonts loaded, Tailwind @theme color tokens)',
@@ -200,13 +234,14 @@ test('Slice 3 Acceptance Criteria: 5-Card Catalog, Brand Tokens & Complementary
); );
}); });
await t.test('Criterion 5: Contextual WhatsApp CTAs & Phone Invariant (5 cards + Hatha)', () => { await t.test('Criterion 5: Contextual WhatsApp CTAs & Phone Invariant (4 cards + Hatha)', () => {
const phone = '573215428972'; const phone = '573215428972';
// Find all WhatsApp links in the document // Find all WhatsApp links in the document
const waLinks = [...indexHtml.matchAll(/href="(https:\/\/wa\.me\/[^"]+)"/gi)].map((m) => m[1]); const waLinks = [...indexHtml.matchAll(/href="(https:\/\/wa\.me\/[^"]+)"/gi)].map((m) => m[1]);
// Must have at least 8 WhatsApp links: floating, hero, 5 cards, hatha, contact // Why: Card 2 now routes to /kundalini/, leaving 9 links (FAB, 2 hero, 4 cards,
// Hatha, contact); >= 8 keeps headroom for copy edits without masking a lost CTA.
assert.ok(waLinks.length >= 8, `Expected at least 8 WhatsApp links, found ${waLinks.length}`); assert.ok(waLinks.length >= 8, `Expected at least 8 WhatsApp links, found ${waLinks.length}`);
const uniqueMessages = new Set(); const uniqueMessages = new Set();
@@ -227,7 +262,7 @@ test('Slice 3 Acceptance Criteria: 5-Card Catalog, Brand Tokens & Complementary
} }
} }
// Check that 5 service cards and Hatha Yoga have unique messages // Why: 7 distinct texts = hero sesiones, 4 non-Kundalini cards, Hatha, contact.
assert.ok( assert.ok(
uniqueMessages.size >= 7, uniqueMessages.size >= 7,
`Expected at least 7 distinct contextual inquiry messages, found ${uniqueMessages.size}`, `Expected at least 7 distinct contextual inquiry messages, found ${uniqueMessages.size}`,
@@ -246,6 +281,22 @@ test('Slice 3 Acceptance Criteria: 5-Card Catalog, Brand Tokens & Complementary
} }
}); });
await t.test('Criterion 5b: Service Card 2 CTA routes in-tab to /kundalini/', () => {
const kundaliniCard = extractCardByHeading(
indexHtml,
'Clases de Kundalini Yoga y Acompañamientos',
);
assert.ok(kundaliniCard, 'Service Card 2 (Kundalini Yoga) must exist in built HTML');
const ctaTag = [...kundaliniCard.matchAll(/<a\b[^>]*>/gi)]
.map((match) => match[0])
.find((tag) => /\bhref="\/kundalini\/"/i.test(tag));
assert.ok(ctaTag, 'Service Card 2 must have a CTA with href="/kundalini/"');
// Why: same-site navigation must stay in the current tab; target/rel are external-link only.
assert.doesNotMatch(ctaTag, /\btarget=/i, 'Card 2 CTA must not open a new tab');
assert.doesNotMatch(ctaTag, /\brel=/i, 'Card 2 CTA must not carry a rel attribute');
});
await t.test( await t.test(
'Criterion 6: Reconciled Caminos Complementarios (Section 04: single container & media strip)', 'Criterion 6: Reconciled Caminos Complementarios (Section 04: single container & media strip)',
() => { () => {