Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions webviews/editorWebview/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1963,10 +1963,10 @@ h3 {
font-weight: normal;
}

/* Markdown headings, lists, and inline code follow github.com's markdown styles. */
/* Markdown headings, lists, and inline code follow github.com's markdown styles. The headers of comments in a review are in their review's comment body. */
.comment-body h1,
.comment-body h2,
.comment-body h3,
.comment-body h3:not(.review-comment-header),
Comment thread
alexr00 marked this conversation as resolved.
Resolved
.comment-body h4,
.comment-body h5,
.comment-body h6 {
Expand All @@ -1992,7 +1992,7 @@ h3 {
font-size: 1.5em;
}

.comment-body h3 {
.comment-body h3:not(.review-comment-header) {
font-size: 1.25em;
}

Expand Down
29 changes: 29 additions & 0 deletions webviews/editorWebview/test/timeline.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { default as assert } from 'assert';
import { readFileSync } from 'fs';
import * as path from 'path';
import * as React from 'react';
import { cleanup, render } from 'react-testing-library';
import { createSandbox, SinonSandbox } from 'sinon';
Expand Down Expand Up @@ -169,6 +171,33 @@ describe('Timeline', function () {
]);
});

it('styles the headers of comments in a review like other comment headers', function () {
const styles = ['common/common.css', 'editorWebview/index.css'].map(file => {
const style = document.createElement('style');
style.textContent = readFileSync(path.resolve('webviews', file), 'utf8');
return document.head.appendChild(style);
});
try {
const view = renderTimeline([{
id: 1, event: EventType.Reviewed, submittedAt: start, body: '', htmlUrl: '', user: bob, authorAssociation: 'MEMBER', state: 'COMMENTED',
comments: [{
id: 2, pullRequestReviewId: 1, path: 'file.ts', position: 1, diffHunk: '', body: '### Heading', bodyHTML: '<h3>Heading</h3>',
url: '', htmlUrl: '', graphNodeId: 'comment', createdAt: start, user: carol,
}],
}]);

const [reviewHeader, commentHeader] = Array.from(view.container.querySelectorAll('.review-comment-header'), header => {
const { fontSize, fontWeight, lineHeight, marginTop, marginBottom } = window.getComputedStyle(header);
return { fontSize, fontWeight, lineHeight, marginTop, marginBottom };
});
assert(commentHeader);
assert.deepStrictEqual(commentHeader, reviewHeader);
assert.strictEqual(window.getComputedStyle(view.container.querySelector('.markdown-body h3')!).fontSize, '1.25em');
} finally {
styles.forEach(style => style.remove());
}
});

it('renders review dismissal, auto-merge, and merge queue events with their reasons', function () {
const view = renderTimeline([
{ id: '1', event: EventType.ReviewDismissed, actor: alice, createdAt: start, reviewAuthor: bob, dismissalMessage: 'Outdated feedback' },
Expand Down
Loading