aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-29 08:37:25 -0700
committerAdam Soltys <[email protected]>2026-09-29 08:37:25 -0700
commit62b8e37109464aca875e306269c181faf6c64ae3 (patch)
treec6f2dddec0c4db898f2c34de72ac67f24fb94b5e /tools
parent6ee2e4e000c9513d09c98554ed0162a97a4f7824 (diff)
downloadcoinosv3-62b8e37109464aca875e306269c181faf6c64ae3.tar.gz
coinosv3-62b8e37109464aca875e306269c181faf6c64ae3.zip
Confirm discarding substantial post drafts
Diffstat (limited to 'tools')
-rw-r--r--tools/post-cancel-test.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/post-cancel-test.js b/tools/post-cancel-test.js
index 5527bf2..217e743 100644
--- a/tools/post-cancel-test.js
+++ b/tools/post-cancel-test.js
@@ -12,6 +12,9 @@ assert(cancel.includes('ui.profCompose = null'), 'composer is closed');
assert(cancel.includes('ui.postMedia = []'), 'pending attachment metadata is removed');
assert(cancel.includes('ui.postPreview = false'), 'preview state is removed');
assert(cancel.includes('discardDraft(POST_DRAFT)'), 'persisted draft is removed immediately');
-assert(source.includes("onClick: cancelPost }, t('cancel')"), 'Cancel button uses the discard handler');
+assert(source.includes("composeText().length > 20"), 'drafts over 20 characters require confirmation');
+assert(source.includes("ui.postUploading || (ui.postMedia || []).length"), 'attachments require confirmation');
+assert(source.includes("onClick: requestCancelPost }, t('cancel')"), 'Cancel button uses the guarded discard handler');
+assert(source.includes("onClick: cancelPost }, t('postDiscard')"), 'warning can confirm the discard');
-console.log('✓ Cancel closes the new-post form and removes its complete saved draft');
+console.log('✓ Cancel warns for substantial drafts, then closes the form and removes its complete saved draft');