File tree Expand file tree Collapse file tree 3 files changed +17
-25
lines changed
tests/lib/enhancers/__snapshots__ Expand file tree Collapse file tree 3 files changed +17
-25
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,16 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
2828 textarea . name === 'pull_request[body]' || textarea . name === 'issue_comment[body]'
2929 // ^this is the root pr comment ^this is the other pr comments (surprising!)
3030
31- if ( ! isIssueBodyEdit && ! isPRBodyEdit ) {
31+ // Also detect comment editing textareas (have "Update comment" button)
32+ // Look for "Update comment" button in the same container as the textarea
33+ const container =
34+ textarea . closest ( '[class*="markdown"], [class*="comment"], .js-comment-edit-form' ) ||
35+ textarea . closest ( 'form' ) ||
36+ textarea . parentElement ?. parentElement ?. parentElement
37+ const buttons = container ? Array . from ( container . querySelectorAll ( 'button' ) ) : [ ]
38+ const isCommentEdit = buttons . some ( ( btn ) => btn . textContent ?. includes ( 'Update comment' ) )
39+
40+ if ( ! isIssueBodyEdit && ! isPRBodyEdit && ! isCommentEdit ) {
3241 return null
3342 }
3443
Original file line number Diff line number Diff line change @@ -53,12 +53,9 @@ exports[`github detection > gh_issue_edit_multiple:should detect correct spots 1
5353 {
5454 " for" : " id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input" ,
5555 " spot" : {
56- " domain" : " github.com" ,
57- " number" : 3 ,
58- " slug" : " diffplug/testing-deletable" ,
59- " title" : " Test 3" ,
60- " type" : " GH_ISSUE_APPEND" ,
61- " unique_key" : " github.com:diffplug/testing-deletable:3" ,
56+ " isIssue" : false ,
57+ " type" : " GH_EDIT" ,
58+ " unique_key" : " github.com:diffplug/testing-deletable:3:edit-body" ,
6259 },
6360 } ,
6461 {
Original file line number Diff line number Diff line change @@ -70,24 +70,10 @@ exports[`github ui > gh_issue_edit_multiple:should render correct UI elements 1`
7070 } ,
7171 {
7272 " for" : " id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input" ,
73- " title" : " Test 3" ,
74- " upperDecoration" : <React.Fragment >
75- <span
76- className = " flex h-4 w-4 flex-shrink-0 items-center justify-center"
77- >
78- <IssueOpenedIcon
79- size = { 16 }
80- />
81- </span >
82- #
83- 3
84- <a
85- className = " truncate hover:underline"
86- href = " https://github.com/diffplug/testing-deletable"
87- >
88- diffplug/testing-deletable
89- </a >
90- </React.Fragment >,
73+ " title" : " N/A" ,
74+ " upperDecoration" : <span >
75+ N/A
76+ </span >,
9177 } ,
9278 {
9379 " for" : " id=:r5b: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
You can’t perform that action at this time.
0 commit comments