Skip to content

Commit 477cb27

Browse files
authored
testing: fix markdown messages not displaying (microsoft#224612)
At the time markdown messages were rendered, the output element was not in the DOM, so its height was always 0. It was also missing a couple of style adjustments. Additionally it tweaks the diff height before we fall back to nested scrollbars -- a limit of 1000px was very low. I had this commit on a branch from earlier but it never made it to PR :x Refs microsoft#224575
1 parent 058efcf commit 477cb27

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/vs/workbench/contrib/testing/browser/media/testing.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@
252252

253253
.test-output-peek-message-container .preview-text {
254254
padding: 8px 12px 8px 20px;
255-
height: calc(100% - 16px);
255+
line-height: normal;
256+
white-space: normal;
256257
}
257258

258259
.test-output-peek-message-container .preview-text p:first-child {

src/vs/workbench/contrib/testing/browser/testResultsView/testResultsOutput.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class DiffContentProvider extends Disposable implements IPeekOutputRender
180180
}
181181

182182
editor.layout(dimensions);
183-
const height = Math.min(1000, Math.max(editor.getOriginalEditor().getContentHeight(), editor.getModifiedEditor().getContentHeight()));
183+
const height = Math.min(10000, Math.max(editor.getOriginalEditor().getContentHeight(), editor.getModifiedEditor().getContentHeight()));
184184
editor.layout({ height, width: dimensions.width });
185185
return height;
186186
}
@@ -219,7 +219,6 @@ export class MarkdownTestMessagePeek extends Disposable implements IPeekOutputRe
219219

220220

221221
const rendered = this._register(this.markdown.value.render(message.message, {}));
222-
rendered.element.style.height = '100%';
223222
rendered.element.style.userSelect = 'text';
224223
rendered.element.classList.add('preview-text');
225224
this.container.appendChild(rendered.element);
@@ -232,7 +231,7 @@ export class MarkdownTestMessagePeek extends Disposable implements IPeekOutputRe
232231
return undefined;
233232
}
234233

235-
this.element.style.width = `${dimension.width}px`;
234+
this.element.style.width = `${dimension.width - 32}px`;
236235
return this.element.clientHeight;
237236
}
238237

src/vs/workbench/contrib/testing/browser/testResultsView/testResultsViewContent.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class MessageStackFrame extends CustomStackFrame {
7474
}
7575

7676
public override render(container: HTMLElement): IDisposable {
77+
this.message.style.visibility = 'visible';
7778
container.appendChild(this.message);
7879
return toDisposable(() => this.message.remove());
7980
}
@@ -320,7 +321,13 @@ export class TestResultsViewContent extends Disposable {
320321
}
321322

322323
private async prepareTopFrame(subject: InspectSubject, callFrames: ITestMessageStackFrame[]) {
324+
// ensure the messageContainer is in the DOM so renderers can calculate the
325+
// dimensions before it's rendered in the list.
326+
this.messageContainer.style.visibility = 'hidden';
327+
this.stackContainer.appendChild(this.messageContainer);
328+
323329
const topFrame = this.currentTopFrame = this.instantiationService.createInstance(MessageStackFrame, this.messageContainer, this.followupWidget, subject);
330+
324331
topFrame.showHeader.set(callFrames.length > 0, undefined);
325332

326333
const provider = await findAsync(this.contentProviders, p => p.update(subject));

0 commit comments

Comments
 (0)