diff --git a/craft/src/panels/topbar/ReportIssueModal.test.tsx b/craft/src/panels/topbar/ReportIssueModal.test.tsx index 77c8527..a1b8b92 100644 --- a/craft/src/panels/topbar/ReportIssueModal.test.tsx +++ b/craft/src/panels/topbar/ReportIssueModal.test.tsx @@ -50,10 +50,22 @@ function render(open = true) { }); } +// The textarea is a controlled input (`onChange`), so React's DOM value +// tracker patches its `value` setter to detect "did this really change". +// A plain `ta.value = text` assignment goes through that same patched +// setter, which updates the tracker's own record of "current value" as a +// side effect -- so by the time the dispatched 'input' event is handled, +// the tracker sees no difference and the synthetic onChange never fires. +// Bypassing the patched setter via the native prototype descriptor (same +// idiom as HeadCodeModal.test.tsx / SiteDesignPanel.reset.test.tsx / +// shared-controls.test.tsx / MediaStylePanel.*.test.tsx) sets the DOM value +// without touching the tracker, so the dispatched event is correctly seen +// as a real change. function typeDescription(text: string) { const ta = document.querySelector('[data-testid="report-description"]') as HTMLTextAreaElement; act(() => { - ta.value = text; + const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')!.set!; + setter.call(ta, text); ta.dispatchEvent(new Event('input', { bubbles: true })); }); } diff --git a/craft/src/panels/topbar/ReportIssueModal.tsx b/craft/src/panels/topbar/ReportIssueModal.tsx index 557f9bc..86cdb95 100644 --- a/craft/src/panels/topbar/ReportIssueModal.tsx +++ b/craft/src/panels/topbar/ReportIssueModal.tsx @@ -210,16 +210,7 @@ export const ReportIssueModal: React.FC = ({ open, onClos