Skip to content

Commit 669b103

Browse files
committed
address comments
1 parent b18a853 commit 669b103

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

packages/core/src/shared/utilities/textDocumentUtilities.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,10 @@ class ReadonlyDocument {
251251
const disposableProvider = vscode.workspace.registerTextDocumentContentProvider(this.scheme, this.provider)
252252
this.provider.setContent(content)
253253
const uri = vscode.Uri.parse(`${this.scheme}:/${filename}.txt`)
254+
// txt document on side column, in focus and preview
254255
const options: vscode.TextDocumentShowOptions = {
255256
viewColumn: vscode.ViewColumn.Beside,
256-
preserveFocus: true,
257+
preserveFocus: false,
257258
preview: true,
258259
}
259260

packages/core/src/test/notifications/rendering.test.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { ToolkitNotification } from '../../notifications/types'
1010
import { panelNode } from './controller.test'
1111
import { getTestWindow } from '../shared/vscode/window'
1212
import * as VsCodeUtils from '../../shared/utilities/vsCodeUtils'
13-
import { readonlyDocument } from '../../shared/utilities/textDocumentUtilities'
13+
import { assertTextEditorContains } from '../testUtil'
1414

1515
describe('Notifications Rendering', function () {
1616
let sandbox: sinon.SinonSandbox
17-
//const panelNode: NotificationsNode = testNotificationsNode
1817

1918
beforeEach(function () {
2019
sandbox = sinon.createSandbox()
@@ -27,23 +26,17 @@ describe('Notifications Rendering', function () {
2726
// util to test txt pop-up under different senarios
2827
async function verifyTxtNotification(notification: ToolkitNotification) {
2928
const expectedContent = notification.uiRenderInstructions.content['en-US'].description
30-
const readonlyDocumentShowStub = sandbox.stub(readonlyDocument, 'show').resolves()
29+
void panelNode.openNotification(notification)
3130

32-
await panelNode.openNotification(notification)
33-
34-
assert.ok(readonlyDocumentShowStub.calledOnce)
35-
assert.ok(readonlyDocumentShowStub.calledWith(expectedContent, `Notification: ${notification.id}`))
31+
await assertTextEditorContains(expectedContent)
3632
}
3733

3834
// util to test open url under different senarios
3935
async function verifyOpenExternalUrl(notification: ToolkitNotification) {
40-
const url = vscode.Uri.parse('https://aws.amazon.com/visualstudiocode/')
41-
//const openExternalStub = getOpenExternalStub()
4236
const openUrlStub = sandbox.stub(VsCodeUtils, 'openUrl')
4337
await panelNode.openNotification(notification)
4438

45-
assert.ok(openUrlStub.calledOnce)
46-
assert.ok(openUrlStub.calledWith(url))
39+
assert.ok(openUrlStub.calledWith(vscode.Uri.parse('https://aws.amazon.com/visualstudiocode/')))
4740
}
4841

4942
// test on-receive behaviors
@@ -130,7 +123,7 @@ describe('Notifications Rendering', function () {
130123
// generate test notifications
131124
function getToastURLTestNotification(): ToolkitNotification {
132125
return {
133-
id: 'test notification',
126+
id: 'test notification 1',
134127
displayIf: {
135128
extensionId: 'aws.toolkit.fake.extension',
136129
},
@@ -153,7 +146,7 @@ function getToastURLTestNotification(): ToolkitNotification {
153146

154147
function getTxtNotification(): ToolkitNotification {
155148
return {
156-
id: 'test notification',
149+
id: 'test notification 2',
157150
displayIf: {
158151
extensionId: 'aws.toolkit.fake.extension',
159152
},
@@ -174,7 +167,7 @@ function getTxtNotification(): ToolkitNotification {
174167

175168
function getModalNotification(): ToolkitNotification {
176169
return {
177-
id: 'test notification',
170+
id: 'test notification 3',
178171
displayIf: {
179172
extensionId: 'aws.toolkit.fake.extension',
180173
},

0 commit comments

Comments
 (0)