feat(forms): preview the form as a respondent sees it, before publishing (#77) #78
No reviewers
Labels
No labels
bug
discussion
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
edufeed/edufeed-app!78
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-77-form-preview"
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?
Closes #77.
Authors can now see their form exactly as a respondent will, before publishing.
What changed
FormPreview.svelte— renders the in-progress form definition through the sameFormRenderera respondent gets, so the preview is the real component, not a mock-up of it.FormBuilder.sveltegains an Edit / Preview tab pair; builder state moves intosrc/lib/helpers/forms/builder-state.jsso the preview and the editor read one source of truth instead of two./forms/[naddr](the published form page) gains the same Preview tab.FormPreview.adapters.test.js), and a comment inCreatorFieldAdapter.sveltethat this change made false is corrected.playwright.config.jspins every app-read relay var so a populated local.envcannot leak a production relay into an e2e run.Behavioural change on an already-shipped page — please read
The published form page's Preview tab now renders a Submit button that publishes nothing. The previous readonly preview had no such button.
This is deliberate: #77 asks the author to be able to see what a respondent sees, and the post-submit confirmation is part of that. The button runs the full validation path and then shows a confirmation whose copy states that nothing was published.
The counter-argument, stated plainly: the same page also carries a real "Fill Form" link, so two controls on one page now look like ways to respond. Suppressing Submit on that route only is ~10 lines if you'd rather. laoc chose to keep it (DM, 2026-08-03).
Verification
pnpm testat25545f8e: 481 files / 5321 tests, all passing.e2e/form-preview.test.js, real Chrome, first attempt) verified independently by TestOER at both854ff46dand the tip25545f8e, with a positive control in the same run.Note on the commit range
The first two commits in this range (
95db6336,cc4368f8— an inbox kind-1 reply fix) are an unrelated change that sits on the localdevtip but has not been pushed toorigin/dev. They are not part of this work; they appear here only because this branch forked from that tip.origin/devitself is untouched.Three specs written by TestOER while verifying the checkbox fix, kept because each measures something the commit's own tests could not. src/lib/__tests__/forms.field-type-sweep.test.js All 13 types FormBuilder offers, driven builderStateToTags → parseFormTemplate against every property the builder lets an author set: label, required, defaultValue, placeholder, min/max, output, choices. The checkbox defect was a serialisation defect and this is the shape that finds another one. Asserts on the PARSED field, never on the intermediate mapping — asserting the intermediate is what let the second of two serial gates hide behind the first. src/lib/__tests__/forms.checkbox-downstream.test.js "A checkbox group has the same value shape select+multiple already used" is a claim about consumers, and the fix exercised none of them. Drives both types through validateField, formValuesToAmbJson (ext / amb-scalar / keywords) and evaluateDisplayIf `contains`, plus the optionless checkbox's boolean contract. e2e/form-checkbox-published.test.js The only spec in the repo that drives a required checkbox past publish. It is the one that refuted this branch's original claim that a required checkbox was unsubmittable on every published form — run with the pre-fix expression restored, it still submits, because FormRenderer.handleFieldChange bridges the boolean/string seam and always has. Kept precisely because it measures a seam a code read got wrong. Two changes on adoption, both mine: - JSDoc types. These were verified with svelte-check run on a tree with them removed, so they had never been type-checked; adding them raised 9 errors (implicit any, and `undefined` rows in it.each that the param type does not admit). Fixed in the tests with casts and annotations — validateField's signature is NOT widened to accommodate a test. - The e2e header cited the retracted claim as though it were open. Rewritten to record what the spec actually established. Re-proven live in this tree rather than assumed from TestOER's run: mutating gate 2 (format.js isOptionType) turns the sweep red 2, mutating gate 1 (builder-state.js CHOICE_TYPES) turns it red 4, and restoring the pre-fix `value !== 'true'` turns the downstream suite red 1. Each patch confirmed landed via git diff --numstat, tree restored between rows. Suite at this commit: 481+2 files, 5436 passed, 0 failed, exit 0 on two consecutive runs. svelte-check 0 errors / 4 warnings = baseline. All three e2e specs pass on real Chrome with --retries=0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.