Skip to content

Commit 95fcd14

Browse files
committed
Try to add our first HTML corpus.
1 parent 1f20c7d commit 95fcd14

File tree

3 files changed

+1591
-6
lines changed

3 files changed

+1591
-6
lines changed

browser-extension/tests/corpus-view.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,16 +524,18 @@ function injectGitcassoScript(key: string, html: string) {
524524
}
525525
526526
// Initial update
527+
updateCommentSpotDisplay()
527528
setTimeout(updateCommentSpotDisplay, 100);
528-
529-
// Update display periodically
530-
setInterval(updateCommentSpotDisplay, 2000);
529+
setTimeout(updateCommentSpotDisplay, 200);
530+
setTimeout(updateCommentSpotDisplay, 400);
531+
setTimeout(updateCommentSpotDisplay, 800);
531532
532533
document.body.appendChild(commentSpotDisplay);
533534
</script>
534535
`
535-
if (!html.includes('</body>')) {
536-
throw error('No closing body tag, nowhere to put the content script!')
536+
if (html.includes('</body>')) {
537+
return html.replace('</body>', `${contentScriptTag}</body>`)
538+
} else {
539+
return html + contentScriptTag
537540
}
538-
return html.replace('</body>', `${contentScriptTag}</body>`)
539541
}

browser-extension/tests/corpus/_corpus-index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export const CORPUS: Record<string, CorpusEntry> = {
1212
type: 'har',
1313
url: 'https://github.com/diffplug/selfie/issues/523',
1414
},
15+
gh_issue_populated_comment: {
16+
type: 'html',
17+
url: 'https://github.com/diffplug/selfie/issues/523',
18+
description: 'comment text box has some text'
19+
},
1520
gh_new_issue: {
1621
type: 'har',
1722
url: 'https://github.com/diffplug/selfie/issues/new',

browser-extension/tests/corpus/html/gh_issue_populated_comment.html

Lines changed: 1578 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)