content: integrate approved project evidence

This commit is contained in:
2026-09-04 23:57:29 +03:00
parent 4735ceffe5
commit 2fce0cedee
15 changed files with 564 additions and 25 deletions

View File

@@ -8,6 +8,8 @@ import ProjectMediaGallery from '@/components/ProjectMediaGallery.vue';
import { useLazyMedia } from '@/composables/useLazyMedia';
import { parsePortfolioContent, parsePublicAssetManifest } from '@/content/schemas';
import type { MediaPresentation, ProductionInputs, PublicAssetManifest } from '@/content/types';
import approvedContentJson from '@/../content/public/portfolio-content.json';
import approvedManifestJson from '@/../content/public/asset-manifest.json';
const sha = 'a'.repeat(64);
const manifest: PublicAssetManifest = {
@@ -226,6 +228,34 @@ describe('ProjectMedia', () => {
});
describe('ProjectMediaGallery', () => {
it('renders every approved project still with intrinsic, lazy, contextual semantics', () => {
const content = parsePortfolioContent(structuredClone(approvedContentJson));
const approvedManifest = parsePublicAssetManifest(structuredClone(approvedManifestJson));
const approvedInputs = { manifest: approvedManifest, content, site: {} } as unknown as ProductionInputs;
const projects = [...content.projects.selected, ...content.projects.additional];
const mediaProjects = projects.filter((project) => project.media !== undefined);
expect(mediaProjects.map(({ id }) => id)).toEqual([
'private-medication-tracker',
'opinion-dynamics-simulation',
'currency-converter',
]);
const wrappers = mediaProjects.map((project) => mount(ProjectMediaGallery, {
props: { media: project.media ?? [], layout: project.mediaLayout ?? 'single' },
global: { provide: { [productionInputsKey as symbol]: approvedInputs } },
}));
const images = wrappers.flatMap((wrapper) => wrapper.findAll('img'));
expect(images).toHaveLength(6);
expect(images.every((image) => image.attributes('loading') === 'lazy')).toBe(true);
expect(images.every((image) => image.attributes('decoding') === 'async')).toBe(true);
expect(images.every((image) => Number(image.attributes('width')) > 0 && Number(image.attributes('height')) > 0)).toBe(true);
expect(wrappers[0]!.text()).toMatch(/fictional demo state|private self-hosted system/iu);
expect(wrappers[1]!.findAll('[data-testid="chart-variables"]')).toHaveLength(2);
expect(wrappers[1]!.findAll('table')).toHaveLength(1);
});
it('keeps three portrait images lazy, contextual, and in their supplied order', () => {
const wrapper = mountGallery([
{ kind: 'image', assetId: 'project-image', alt: 'Synthetic profile screen.', caption: 'Fictional demo profile.' },