feat: complete CHRNX responsive content states
This commit is contained in:
60 files changed
+1699
-22
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
export default function globalSetup() {
|
||||
execFileSync(
|
||||
'npm',
|
||||
[ 'exec', '--', 'wp-env', 'run', 'cli', 'wp', 'eval', 'chrnx_seed_editorial_terms();' ],
|
||||
{ cwd: process.cwd(), env: process.env, stdio: 'inherit' },
|
||||
);
|
||||
execFileSync( './scripts/seed-test-content.sh', [], {
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
stdio: 'inherit',
|
||||
} );
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { injectAxe } from 'axe-playwright';
|
||||
|
||||
const viewports = [
|
||||
{ width: 375, height: 812 },
|
||||
{ width: 768, height: 1024 },
|
||||
{ width: 1440, height: 900 },
|
||||
{ width: 2560, height: 1440 },
|
||||
];
|
||||
|
||||
async function expectNoHorizontalOverflow( page ) {
|
||||
const overflow = await page.evaluate( () => ( {
|
||||
document: document.documentElement.scrollWidth - window.innerWidth,
|
||||
body: document.body.scrollWidth - window.innerWidth,
|
||||
} ) );
|
||||
expect( overflow.document ).toBeLessThanOrEqual( 1 );
|
||||
expect( overflow.body ).toBeLessThanOrEqual( 1 );
|
||||
}
|
||||
|
||||
test( 'home remains coherent at all approved review viewports', async ( { page } ) => {
|
||||
for ( const viewport of viewports ) {
|
||||
await page.setViewportSize( viewport );
|
||||
await page.goto( '/' );
|
||||
await expect( page.getByRole( 'banner' ) ).toBeVisible();
|
||||
await expect( page.locator( 'main#chrnx-main' ) ).toBeVisible();
|
||||
await expect( page.getByRole( 'contentinfo' ) ).toBeVisible();
|
||||
await expect( page.getByRole( 'heading', { level: 1 } ) ).toHaveCount( 1 );
|
||||
await expect( page.getByText( 'Selected work', { exact: true } ) ).toBeVisible();
|
||||
await expect( page.getByText( 'The No Names', { exact: true } ).first() ).toBeVisible();
|
||||
await expect( page.locator( 'picture source[type="image/avif"]' ).first() ).toHaveAttribute(
|
||||
'srcset',
|
||||
/384\.avif 384w/,
|
||||
);
|
||||
await expectNoHorizontalOverflow( page );
|
||||
}
|
||||
} );
|
||||
|
||||
test( 'topic, music, podcast, and about surfaces use real content and approved art', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
for ( const [ path, heading, asset ] of [
|
||||
[ '/topic/code/', 'Code', 'alter-ego-code' ],
|
||||
[ '/topic/research/', 'Research', 'alter-ego-research' ],
|
||||
[ '/topic/gaming/', 'Gaming', 'alter-ego-gaming' ],
|
||||
] ) {
|
||||
await page.goto( path );
|
||||
await expect( page.getByRole( 'heading', { level: 1, name: heading } ) ).toBeVisible();
|
||||
await expect( page.locator( `.chrnx-topic-hero img[src*="${ asset }.png"]` ) ).toBeVisible();
|
||||
await expectNoHorizontalOverflow( page );
|
||||
}
|
||||
|
||||
await page.goto( '/music/' );
|
||||
await expect( page.getByRole( 'heading', { level: 1, name: 'Music' } ) ).toBeVisible();
|
||||
await expect( page.getByText( 'Grunge mexicano para cerebros que no se callan.' ) ).toBeVisible();
|
||||
await expect(
|
||||
page.locator( 'picture img[src*="the-no-names-musician-cutout.png"]' ),
|
||||
).toBeVisible();
|
||||
|
||||
await page.goto( '/podcasts/' );
|
||||
await expect( page.getByRole( 'heading', { level: 1, name: 'Podcasts' } ) ).toBeVisible();
|
||||
await expect( page.locator( 'picture img[src*="alter-ego-podcasts.png"]' ) ).toBeVisible();
|
||||
await expect( page.locator( 'iframe, audio' ) ).toHaveCount( 0 );
|
||||
|
||||
await page.goto( '/about/' );
|
||||
await expect( page.getByRole( 'heading', { level: 1, name: 'About' } ) ).toBeVisible();
|
||||
await expect( page.getByRole( 'link', { name: 'arXiv:2603.05352' } ) ).toHaveAttribute(
|
||||
'href',
|
||||
'https://arxiv.org/abs/2603.05352',
|
||||
);
|
||||
await expect( page.locator( '.chrnx-about__portraits picture' ) ).toHaveCount( 3 );
|
||||
} );
|
||||
|
||||
test( 'long, incomplete, empty, and missing states stay usable', async ( { page } ) => {
|
||||
await page.goto( '/?s=fixture-that-cannot-exist' );
|
||||
await expect( page.getByText( 'No journal entries match these filters yet.' ) ).toBeVisible();
|
||||
await expect( page.getByRole( 'link', { name: 'Browse the full Journal' } ) ).toBeVisible();
|
||||
|
||||
await page.goto( '/conversacion-pendiente-de-datos-editoriales/' );
|
||||
await expect(
|
||||
page.getByRole( 'heading', { level: 1, name: 'Conversación pendiente de datos editoriales' } ),
|
||||
).toBeVisible();
|
||||
await expect( page.locator( '.chrnx-podcast-meta' ) ).toHaveCount( 0 );
|
||||
|
||||
await page.goto( '/emotion-is-not-a-slider-designing-expressive-systems-that-can-hesitate/' );
|
||||
await expect( page.locator( 'pre code' ) ).toContainText( 'const state' );
|
||||
await expectNoHorizontalOverflow( page );
|
||||
|
||||
await page.goto( '/this-route-does-not-exist/' );
|
||||
await expect( page ).toHaveTitle( /Page not found/i );
|
||||
await expect( page.getByRole( 'heading', { level: 1, name: 'Page not found' } ) ).toBeVisible();
|
||||
} );
|
||||
|
||||
test( 'reduced motion removes card transitions while theme preference remains user-controlled', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await page.emulateMedia( { reducedMotion: 'reduce', colorScheme: 'light' } );
|
||||
await page.goto( '/' );
|
||||
const card = page.locator( '.chrnx-featured-story' ).first();
|
||||
const duration = await card.evaluate( ( element ) =>
|
||||
Number.parseFloat( window.getComputedStyle( element ).transitionDuration ),
|
||||
);
|
||||
expect( duration ).toBeLessThanOrEqual( 0.001 );
|
||||
await expect( page.locator( '.chrnx-home-music h2' ) ).toHaveCSS( 'color', 'rgb(230, 237, 243)' );
|
||||
await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check();
|
||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||
} );
|
||||
|
||||
test( 'key public surfaces pass automated WCAG 2.2 AA checks', async ( { page }, testInfo ) => {
|
||||
test.skip(
|
||||
testInfo.project.name !== 'chromium',
|
||||
'One engine is sufficient for deterministic axe rules.',
|
||||
);
|
||||
const tags = [ 'wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa' ];
|
||||
for ( const viewport of [ viewports[ 0 ], viewports[ 2 ] ] ) {
|
||||
await page.setViewportSize( viewport );
|
||||
for ( const path of [
|
||||
'/',
|
||||
'/music/',
|
||||
'/podcasts/',
|
||||
'/about/',
|
||||
'/topic/code/',
|
||||
'/?s=fixture-that-cannot-exist',
|
||||
'/this-route-does-not-exist/',
|
||||
] ) {
|
||||
await page.goto( path );
|
||||
await injectAxe( page );
|
||||
const violations = await page.evaluate( async ( runOnly ) => {
|
||||
const result = await globalThis.axe.run( document, {
|
||||
runOnly: { type: 'tag', values: runOnly },
|
||||
} );
|
||||
return result.violations.map( ( violation ) => ( {
|
||||
id: violation.id,
|
||||
impact: violation.impact,
|
||||
nodes: violation.nodes.map( ( node ) => node.target ),
|
||||
} ) );
|
||||
}, tags );
|
||||
expect( violations, `${ path } at ${ viewport.width }px` ).toEqual( [] );
|
||||
}
|
||||
}
|
||||
} );
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
[
|
||||
{
|
||||
"fixtureKey": "page-home",
|
||||
"slug": "home",
|
||||
"title": "CHRNX",
|
||||
"status": "publish",
|
||||
"content": ""
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-journal",
|
||||
"slug": "journal",
|
||||
"title": "Journal",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Notas desde el taller</p><!-- /wp:paragraph --><!-- wp:chrnx/journal-stream /-->"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-projects",
|
||||
"slug": "projects",
|
||||
"title": "Projects",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Software · investigación · sistemas expresivos</p><!-- /wp:paragraph --><!-- wp:pattern {\"slug\":\"chrnx/home-projects\"} /--><!-- wp:pattern {\"slug\":\"chrnx/project-detail\"} /-->"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-music",
|
||||
"slug": "music",
|
||||
"title": "Music",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:pattern {\"slug\":\"chrnx/music-landing\"} /-->"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-podcasts",
|
||||
"slug": "podcasts",
|
||||
"title": "Podcasts",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:pattern {\"slug\":\"chrnx/podcast-landing\"} /--><!-- wp:chrnx/latest-podcast /-->"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-about",
|
||||
"slug": "about",
|
||||
"title": "About",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:pattern {\"slug\":\"chrnx/about\"} /-->"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "page-subscribe",
|
||||
"slug": "subscribe",
|
||||
"title": "Subscribe",
|
||||
"status": "publish",
|
||||
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Stay close to the work</h2><!-- /wp:heading --><!-- wp:paragraph --><p>New notes, experiments, music, and conversations. The final subscription provider will be connected before launch.</p><!-- /wp:paragraph -->"
|
||||
}
|
||||
]
|
||||
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
[
|
||||
{
|
||||
"fixtureKey": "post-code-primary",
|
||||
"title": "Emotion is not a slider: designing expressive systems that can hesitate",
|
||||
"excerpt": "A working note on modeling emotional state without flattening behavior into a single number.",
|
||||
"content": "<!-- wp:paragraph --><p>Expressive software gets interesting when uncertainty is part of the model instead of an error to erase.</p><!-- /wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><code>const state = observe(world);\nconst choice = agent.respond(state, { uncertainty: true });</code></pre><!-- /wp:code -->",
|
||||
"topic": "code",
|
||||
"language": "en",
|
||||
"featured": true
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-research-primary",
|
||||
"title": "What game AI can learn from the uncomfortable space between intention and action",
|
||||
"excerpt": "Research notes from the intersection of emotion modeling, agency, and believable play.",
|
||||
"content": "<!-- wp:paragraph --><p>My research asks how internal state becomes behavior players can read without turning a character into a dashboard.</p><!-- /wp:paragraph -->",
|
||||
"topic": "research",
|
||||
"language": "en",
|
||||
"featured": true
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-gaming-primary",
|
||||
"title": "The save file remembers what the hero pretends to forget",
|
||||
"excerpt": "A design sketch about memory, consequence, and the stories systems tell behind our backs.",
|
||||
"content": "<!-- wp:paragraph --><p>Games become personal when the system remembers a decision after the player has renamed it.</p><!-- /wp:paragraph -->",
|
||||
"topic": "gaming",
|
||||
"language": "en",
|
||||
"featured": true
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-literature-long",
|
||||
"title": "Escribir cuando la casa por fin se queda en silencio y cada pequeño ruido parece tener una opinión larguísima sobre el borrador abierto",
|
||||
"excerpt": "Notas sobre escribir de noche, editar sin piedad y conservar la parte que todavía respira.",
|
||||
"content": "<!-- wp:paragraph --><p>La noche no vuelve más inteligente al texto, pero sí deja escuchar dónde está fingiendo.</p><!-- /wp:paragraph -->",
|
||||
"topic": "literature",
|
||||
"language": "es",
|
||||
"fixtureState": "long-title"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-music-studio",
|
||||
"title": "Una cuerda rota también puede decidir el arreglo",
|
||||
"excerpt": "Diario de producción de The No Names: estudio crudo, cero live.",
|
||||
"content": "<!-- wp:paragraph --><p>La toma no quedó limpia. Quedó viva, que para este disco importa bastante más.</p><!-- /wp:paragraph -->",
|
||||
"topic": "music",
|
||||
"language": "es",
|
||||
"fixtureState": "missing-media"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-podcast-episode",
|
||||
"title": "Silicon Ranch: conversaciones sin diapositivas",
|
||||
"excerpt": "Un episodio local de demostración para probar estructura, metadatos y estados sin publicar datos de cohosts.",
|
||||
"content": "<!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
|
||||
"topic": "podcasts",
|
||||
"language": "es",
|
||||
"show": "silicon-ranch",
|
||||
"episodeNumber": 2,
|
||||
"episodeDuration": "58:24"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-podcast-missing-meta",
|
||||
"title": "Conversación pendiente de datos editoriales",
|
||||
"excerpt": "Estado de prueba para un episodio sin show ni duración asignados.",
|
||||
"content": "<!-- wp:paragraph --><p>El tema debe seguir siendo claro aunque la ficha editorial todavía esté incompleta.</p><!-- /wp:paragraph -->",
|
||||
"topic": "podcasts",
|
||||
"language": "es",
|
||||
"fixtureState": "missing-podcast-meta"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-life-fatherhood",
|
||||
"title": "Tres voces en casa y una idea que tendrá que esperar",
|
||||
"excerpt": "La vida diaria no interrumpe el trabajo: le da escala, límites y sentido.",
|
||||
"content": "<!-- wp:paragraph --><p>Hay ideas que mejoran cuando esperan a que termine la tarea, el juego o la conversación importante.</p><!-- /wp:paragraph -->",
|
||||
"topic": "life",
|
||||
"language": "es"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-code-open-source",
|
||||
"title": "Small interfaces, fewer lies",
|
||||
"excerpt": "Why narrow APIs often produce software that is easier to trust and maintain.",
|
||||
"content": "<!-- wp:paragraph --><p>A public interface is a promise. Smaller promises leave less room for accidental fiction.</p><!-- /wp:paragraph -->",
|
||||
"topic": "code",
|
||||
"language": "en"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-research-paper",
|
||||
"title": "From a paper to a playable question",
|
||||
"excerpt": "Turning published research into experiments that can be felt, inspected, and challenged.",
|
||||
"content": "<!-- wp:paragraph --><p>Publication is not the end of an idea. It is where other people finally get a fair chance to disagree with it.</p><!-- /wp:paragraph -->",
|
||||
"topic": "research",
|
||||
"language": "en"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-gaming-accessibility",
|
||||
"title": "Difficulty is a conversation, not a gate",
|
||||
"excerpt": "A note about challenge, access, and respecting different ways of reading a game.",
|
||||
"content": "<!-- wp:paragraph --><p>Accessibility does not remove authorship. It gives more players a route into it.</p><!-- /wp:paragraph -->",
|
||||
"topic": "gaming",
|
||||
"language": "en"
|
||||
},
|
||||
{
|
||||
"fixtureKey": "post-literature-draft",
|
||||
"title": "El monstruo en el margen",
|
||||
"excerpt": "Un fragmento breve sobre notas que empiezan como correcciones y terminan confesando otra historia.",
|
||||
"content": "<!-- wp:quote --><blockquote class=\"wp-block-quote\"><p>La tinta sabía algo que el narrador todavía no.</p></blockquote><!-- /wp:quote -->",
|
||||
"topic": "literature",
|
||||
"language": "es"
|
||||
}
|
||||
]
|
||||
@@ -59,10 +59,11 @@ class PatternsTest extends WP_UnitTestCase {
|
||||
/** Local art is generated through escaped theme URIs with intrinsic dimensions. */
|
||||
public function test_art_patterns_use_only_escaped_local_theme_images() {
|
||||
foreach ( array( 'home-music', 'music-landing', 'podcast-landing', 'podcast-show' ) as $name ) {
|
||||
$source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
|
||||
$content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) );
|
||||
$this->assertStringContainsString( 'get_theme_file_uri(', $source, $name );
|
||||
$this->assertStringContainsString( 'esc_url(', $source, $name );
|
||||
$source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
|
||||
$content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) );
|
||||
$uses_responsive_helper = str_contains( $source, 'chrnx_get_topic_portrait_markup(' );
|
||||
$uses_direct_uri = str_contains( $source, 'get_theme_file_uri(' ) && str_contains( $source, 'esc_url(' );
|
||||
$this->assertTrue( $uses_responsive_helper || $uses_direct_uri, $name );
|
||||
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bwidth="1122"[^>]*\bheight="1402"/i', $content, $name );
|
||||
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bloading="lazy"[^>]*\bdecoding="async"/i', $content, $name );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Responsive theme media tests.
|
||||
*
|
||||
* @package CHRNX
|
||||
*/
|
||||
|
||||
/** Responsive asset helper coverage. */
|
||||
class ResponsiveMediaTest extends WP_UnitTestCase {
|
||||
/** Approved topic portraits render a compact picture element with a PNG fallback. */
|
||||
public function test_topic_portrait_picture_markup_has_modern_sources_and_dimensions() {
|
||||
$markup = chrnx_get_topic_portrait_markup( 'code', 'Code workshop portrait', 'chrnx-section-portrait' );
|
||||
|
||||
$this->assertStringContainsString( '<picture', $markup );
|
||||
$this->assertStringContainsString( 'type="image/avif"', $markup );
|
||||
$this->assertStringContainsString( 'type="image/webp"', $markup );
|
||||
$this->assertStringContainsString( 'alter-ego-code.png', $markup );
|
||||
$this->assertStringContainsString( 'width="1122"', $markup );
|
||||
$this->assertStringContainsString( 'height="1402"', $markup );
|
||||
$this->assertStringContainsString( 'loading="lazy"', $markup );
|
||||
$this->assertStringContainsString( 'decoding="async"', $markup );
|
||||
$this->assertStringContainsString( 'sizes="(max-width: 599px) 70vw, 384px"', $markup );
|
||||
$this->assertStringContainsString( 'alt="Code workshop portrait"', $markup );
|
||||
}
|
||||
|
||||
/** Unknown topic values cannot synthesize asset paths. */
|
||||
public function test_unknown_topic_portrait_returns_empty_markup() {
|
||||
$this->assertSame( '', chrnx_get_topic_portrait_markup( '../../private', '', '' ) );
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,15 @@ import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import test from 'node:test';
|
||||
|
||||
test( 'Playwright seeds editorial prerequisites once outside browser workers', async () => {
|
||||
test( 'Playwright seeds deterministic local fixtures once outside browser workers', async () => {
|
||||
const config = await readFile( 'playwright.config.mjs', 'utf8' );
|
||||
const setup = await readFile( 'tests/e2e/global-setup.mjs', 'utf8' );
|
||||
const seed = await readFile( 'scripts/seed-test-content.php', 'utf8' );
|
||||
const spec = await readFile( 'tests/e2e/editorial-editor.spec.mjs', 'utf8' );
|
||||
|
||||
assert.match( config, /globalSetup:\s*['"]\.\/tests\/e2e\/global-setup\.mjs['"]/ );
|
||||
assert.match( setup, /wp-env.*chrnx_seed_editorial_terms\(\);/s );
|
||||
assert.equal( setup.match( /chrnx_seed_editorial_terms/g )?.length, 1 );
|
||||
assert.match( setup, /execFileSync\(\s*['"]\.\/scripts\/seed-test-content\.sh['"]/s );
|
||||
assert.equal( setup.match( /seed-test-content\.sh/g )?.length, 1 );
|
||||
assert.equal( seed.match( /chrnx_seed_editorial_terms\(\);/g )?.length, 1 );
|
||||
assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ );
|
||||
} );
|
||||
@@ -0,0 +1,69 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { test } from 'node:test';
|
||||
|
||||
const read = ( path ) => readFileSync( new URL( `../../${ path }`, import.meta.url ), 'utf8' );
|
||||
|
||||
test( 'local visual fixtures define stable pages and representative editorial states', () => {
|
||||
const pages = JSON.parse( read( 'tests/fixtures/pages.json' ) );
|
||||
const posts = JSON.parse( read( 'tests/fixtures/posts.json' ) );
|
||||
|
||||
assert.deepEqual(
|
||||
pages.map( ( page ) => page.slug ),
|
||||
[ 'home', 'journal', 'projects', 'music', 'podcasts', 'about', 'subscribe' ],
|
||||
);
|
||||
assert.ok( pages.every( ( page ) => page.fixtureKey && page.status === 'publish' ) );
|
||||
assert.ok( posts.length >= 10 );
|
||||
assert.ok( posts.some( ( post ) => post.title.length > 100 ) );
|
||||
assert.ok( posts.some( ( post ) => post.content.includes( 'wp:code' ) ) );
|
||||
assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-media' ) );
|
||||
assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-podcast-meta' ) );
|
||||
for ( const topic of [ 'code', 'research', 'gaming', 'literature', 'music', 'podcasts', 'life' ] ) {
|
||||
assert.ok( posts.some( ( post ) => post.topic === topic ), `missing ${ topic } fixture` );
|
||||
}
|
||||
} );
|
||||
|
||||
test( 'the seed entrypoint is explicitly local-only and uses a stable fixture key', () => {
|
||||
const shell = read( 'scripts/seed-test-content.sh' );
|
||||
const php = read( 'scripts/seed-test-content.php' );
|
||||
|
||||
assert.match( shell, /localhost|127\.0\.0\.1/ );
|
||||
assert.match( shell, /wp eval-file/ );
|
||||
assert.match( php, /_chrnx_fixture_key/ );
|
||||
assert.match( php, /show_on_front/ );
|
||||
assert.match( php, /page_on_front/ );
|
||||
assert.match( php, /page_for_posts/ );
|
||||
} );
|
||||
|
||||
test( 'the visual layer is separately enqueued and covers responsive accessible states', () => {
|
||||
const assets = read( 'inc/assets.php' );
|
||||
const components = read( 'assets/css/components.css' );
|
||||
|
||||
assert.match( assets, /chrnx-components/ );
|
||||
assert.match( components, /\.chrnx-section-portrait/ );
|
||||
assert.match( components, /prefers-reduced-motion/ );
|
||||
assert.match( components, /@media \(max-width: 599px\)/ );
|
||||
assert.match( components, /html\[data-theme="light"\]/ );
|
||||
} );
|
||||
|
||||
test( 'all approved portraits expose reproducible WebP and AVIF derivatives', () => {
|
||||
for ( const topic of [ 'code', 'gaming', 'life', 'literature', 'podcasts', 'research' ] ) {
|
||||
const manifest = JSON.parse( read( `assets/images/generated/alter-ego-${ topic }.json` ) );
|
||||
assert.equal( manifest.source, `alter-ego-${ topic }.png` );
|
||||
assert.deepEqual( manifest.formats, [ 'avif', 'webp' ] );
|
||||
assert.deepEqual( manifest.widths, [ 384, 768 ] );
|
||||
}
|
||||
} );
|
||||
|
||||
test( 'front page and section pages connect the real editorial patterns', () => {
|
||||
const front = read( 'templates/front-page.html' );
|
||||
assert.match( front, /chrnx\/home-intro/ );
|
||||
assert.match( front, /chrnx\/featured-stories/ );
|
||||
assert.match( front, /chrnx\/journal-stream/ );
|
||||
assert.match( front, /chrnx\/latest-podcast/ );
|
||||
|
||||
const fixtures = read( 'tests/fixtures/pages.json' );
|
||||
for ( const slug of [ 'chrnx/about', 'chrnx/music-landing', 'chrnx/podcast-landing' ] ) {
|
||||
assert.match( fixtures, new RegExp( slug.replace( '/', '\\/' ) ) );
|
||||
}
|
||||
} );
|
||||
Reference in new issue
Block a user