fix(repo): keep the Markdown outline out of the live DOM until it opens #225
No reviewers
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/forgejo-codefloe!225
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/outline-template-e2e"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the
test-e2e (1/2)failure onv16.0/forgejo-codefloe(https://codefloe.com/codefloe/forgejo-codefloe/actions/runs/1679/jobs/3/attempt/2).Cause
The Markdown outline popup from #221 was rendered as a hidden
<div>, so every heading text existed twice in the page.Upstream
repo-new.test.e2e.ts›New repo: initialize latertypes# Heading\n\nHello Forgejo!into the editor; on Mobile Chrome the newlines get lost, so the text ends up in the<h1>.getByText('Hello Forgejo!')then matched both the heading and the hidden outline link, which is a strict mode violation (Playwright counts hidden elements too).Fix
templates/repo/codefloe_file_outline_popup.tmpl: wrap the popup in a<template>, so its content is not part of the live DOM.web_src/js/codefloe/file-outline.js: on first click, move the template content into the tippy instead of un-hiding a sibling.tests/integration/codefloe_file_outline_test.go: point the README assertion at the template.README.md: append this PR to the Markdown outline row.The upstream test stays untouched.
Verification
repo-new.test.e2e.tsfails locally with the same strict mode violation on Mobile Chrome; with it, all 18 pass (chromium, firefox, Mobile Chrome).codefloe-file-outline.test.e2e.ts: 6/6 pass.TestFileOutlineandTestViewRepoDirectoryReadmepass;file-outline.test.js6/6; prek hooks pass.