@@ -347,3 +347,111 @@ test('the space toolbar Share menu bundles the space as context and copies its l
347347 await expect . poll ( ( ) => readClipboardText ( page ) ) . toBe ( 'https://example.com/project-charter' )
348348 } )
349349} )
350+
351+ // Atlas projections (docs/goals/0064, ADR-0038): mirror-content
352+ // rendering, the traceability matrix, and coverage -- each proven
353+ // against the real seed, the same pattern every test above follows.
354+
355+ test ( 'a card with a Mirror path pointing at a markdown file renders its content read-only in the overlay' , async ( { page } ) => {
356+ const fs = await import ( 'node:fs' )
357+ const os = await import ( 'node:os' )
358+ const path = await import ( 'node:path' )
359+ const dir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'mill-e2e-atlas-mirror-' ) )
360+ const file = path . join ( dir , 'notes.md' )
361+ fs . writeFileSync ( file , '# Field notes\n\nSome **captured** text.' )
362+
363+ const title = 'ZzE2eAtlasMirrorCard'
364+ await page . goto ( '/' )
365+ await page . getByRole ( 'link' , { name : 'Atlas' } ) . click ( )
366+ await page . getByTestId ( 'atlas-shelf-card' ) . filter ( { hasText : 'My space' } ) . click ( )
367+ await expect ( page . getByTestId ( 'atlas-canvas' ) ) . toBeVisible ( )
368+
369+ await page . getByTestId ( 'atlas-add-button' ) . click ( )
370+ await page . getByTestId ( 'atlas-add-child' ) . click ( )
371+ await page . getByTestId ( 'atlas-create-kind' ) . selectOption ( { label : '📄 Document' } )
372+ await page . getByTestId ( 'atlas-create-title' ) . fill ( title )
373+ await page . getByRole ( 'button' , { name : 'Create' } ) . click ( )
374+
375+ const newCard = page . getByTestId ( 'atlas-canvas-card' ) . filter ( { hasText : title } )
376+ await expect ( newCard ) . toBeVisible ( )
377+ await newCard . getByTestId ( 'atlas-card-info' ) . click ( )
378+ const overlay = page . locator ( '[data-component="atlas-card-overlay"]' )
379+ await expect ( overlay ) . toBeVisible ( )
380+
381+ await overlay . getByTestId ( 'atlas-overlay-mirror-path' ) . fill ( file )
382+ await overlay . getByTestId ( 'atlas-overlay-save' ) . click ( )
383+ await expect ( overlay ) . not . toBeVisible ( )
384+
385+ await newCard . getByTestId ( 'atlas-card-info' ) . click ( )
386+ await expect ( overlay ) . toBeVisible ( )
387+ await expect ( overlay . getByTestId ( 'atlas-mirror-markdown' ) ) . toBeVisible ( )
388+ await expect ( overlay . getByTestId ( 'atlas-mirror-markdown' ) ) . toContainText ( 'Field notes' )
389+ await expect ( overlay . getByTestId ( 'atlas-mirror-markdown' ) . locator ( 'strong' ) ) . toContainText ( 'captured' )
390+
391+ // Cleanup (testing.md's within-file cleanup discipline).
392+ await overlay . getByTestId ( 'atlas-overlay-delete' ) . click ( )
393+ await page . getByRole ( 'alertdialog' ) . getByRole ( 'button' , { name : 'Delete' } ) . click ( )
394+ await expect ( newCard ) . not . toBeVisible ( )
395+ } )
396+
397+ test ( 'the traceability matrix pivots a space\'s cards by kind against link kinds, with an absent cell shown explicitly' , async ( { page } ) => {
398+ await page . goto ( '/' )
399+ await page . getByRole ( 'link' , { name : 'Atlas' } ) . click ( )
400+ await page . getByTestId ( 'atlas-shelf-card' ) . filter ( { hasText : 'My space' } ) . click ( )
401+ await page . getByTestId ( 'atlas-canvas-card' ) . filter ( { hasText : 'Example area' } ) . click ( )
402+ await expect ( page . getByTestId ( 'atlas-shelves' ) ) . toBeVisible ( )
403+
404+ await page . getByTestId ( 'atlas-open-matrix' ) . click ( )
405+ const dialog = page . locator ( '[data-component="atlas-matrix-dialog"]' )
406+ await expect ( dialog ) . toBeVisible ( )
407+
408+ // Row kind "Contact" -- the seeded "Ada Lovelace" card has an
409+ // outgoing "relates to" link to "Project charter", so its cell names
410+ // that target.
411+ await dialog . getByTestId ( 'atlas-matrix-row-kind' ) . selectOption ( { label : '👤 Contact' } )
412+ await expect ( dialog . getByTestId ( 'atlas-matrix-target' ) . filter ( { hasText : 'Project charter' } ) ) . toBeVisible ( )
413+
414+ // Row kind "Document" -- the seeded "Project charter" card has no
415+ // OUTGOING links of its own (only an incoming one), so its cell is
416+ // explicitly absent, never an ambiguous blank.
417+ await dialog . getByTestId ( 'atlas-matrix-row-kind' ) . selectOption ( { label : '📄 Document' } )
418+ await expect ( dialog . getByTestId ( 'atlas-matrix-absent-cell' ) ) . toBeVisible ( )
419+ await expect ( dialog . getByTestId ( 'atlas-matrix-absent-cell' ) ) . toHaveText ( 'None' )
420+
421+ await page . keyboard . press ( 'Escape' )
422+ await expect ( dialog ) . not . toBeVisible ( )
423+ } )
424+
425+ test ( 'coverage counts a space\'s cards missing a link and missing a mirror, with the missing list navigating to a card' , async ( { page } ) => {
426+ await page . goto ( '/' )
427+ await page . getByRole ( 'link' , { name : 'Atlas' } ) . click ( )
428+ await page . getByTestId ( 'atlas-shelf-card' ) . filter ( { hasText : 'My space' } ) . click ( )
429+ await expect ( page . getByTestId ( 'atlas-canvas' ) ) . toBeVisible ( )
430+
431+ // "My space" itself has exactly two seeded children: "Getting
432+ // started" (has an outgoing "relates to" link to "Ada Lovelace") and
433+ // "Example area" (the container card itself has no link of its own)
434+ // -- a hand-countable 1/2 linked. Neither child carries a mirror at
435+ // THIS level (the seeded mirror lives one level deeper, on "Project
436+ // charter") -- a hand-countable 0/2 mirrored.
437+ await page . getByTestId ( 'atlas-open-coverage' ) . click ( )
438+ const dialog = page . locator ( '[data-component="atlas-coverage-dialog"]' )
439+ await expect ( dialog ) . toBeVisible ( )
440+
441+ await expect ( dialog . getByTestId ( 'atlas-coverage-link-value' ) ) . toHaveText ( '1/2 linked' )
442+ await expect ( dialog . getByTestId ( 'atlas-coverage-mirror-value' ) ) . toHaveText ( '0/2 mirrored' )
443+
444+ await dialog . getByTestId ( 'atlas-coverage-link-toggle' ) . click ( )
445+ await expect ( dialog . getByTestId ( 'atlas-coverage-missing-item' ) . filter ( { hasText : 'Example area' } ) ) . toBeVisible ( )
446+
447+ await dialog . getByTestId ( 'atlas-coverage-mirror-toggle' ) . click ( )
448+ const missingItem = dialog . getByTestId ( 'atlas-coverage-missing-item' ) . filter ( { hasText : 'Getting started' } )
449+ await expect ( missingItem ) . toBeVisible ( )
450+ await missingItem . click ( )
451+
452+ await expect ( dialog ) . not . toBeVisible ( )
453+ const overlay = page . locator ( '[data-component="atlas-card-overlay"]' )
454+ await expect ( overlay ) . toBeVisible ( )
455+ await expect ( overlay . getByTestId ( 'atlas-overlay-title' ) ) . toHaveValue ( 'Getting started' )
456+ await page . keyboard . press ( 'Escape' )
457+ } )
0 commit comments