Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/contrib/chat/test/browser/runScriptCustomTaskWidget.fixture.ts
13405 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ComponentFixtureContext, defineComponentFixture, defineThemedFixtureGroup } from '../../../../../workbench/test/browser/componentFixtures/fixtureUtils.js';
7
import { IRunScriptCustomTaskWidgetState, RunScriptCustomTaskWidget, WORKTREE_CREATED_RUN_ON } from '../../browser/runScriptCustomTaskWidget.js';
8
9
// Ensure color registrations are loaded
10
import '../../../../common/theme.js';
11
import '../../../../../platform/theme/common/colors/inputColors.js';
12
13
const filledLabel = 'Start Dev Server';
14
const filledCommand = 'npm run dev';
15
const workspaceUnavailableReason = 'Workspace storage is unavailable for this session';
16
17
function renderWidget(ctx: ComponentFixtureContext, state: IRunScriptCustomTaskWidgetState): void {
18
ctx.container.style.width = '600px';
19
ctx.container.style.padding = '0';
20
ctx.container.style.borderRadius = 'var(--vscode-cornerRadius-xLarge)';
21
ctx.container.style.backgroundColor = 'var(--vscode-quickInput-background)';
22
ctx.container.style.overflow = 'hidden';
23
24
const widget = ctx.disposableStore.add(new RunScriptCustomTaskWidget(state));
25
ctx.container.appendChild(widget.domNode);
26
}
27
28
function defineFixture(state: IRunScriptCustomTaskWidgetState) {
29
return defineComponentFixture({
30
labels: { kind: 'screenshot' },
31
render: ctx => renderWidget(ctx, state),
32
});
33
}
34
35
export default defineThemedFixtureGroup({ path: 'sessions/' }, {
36
WorkspaceSelectedEmpty: defineFixture({
37
target: 'workspace',
38
}),
39
40
WorkspaceSelectedCheckedEmpty: defineFixture({
41
target: 'workspace',
42
runOn: WORKTREE_CREATED_RUN_ON,
43
}),
44
45
WorkspaceSelectedFilled: defineFixture({
46
label: filledLabel,
47
target: 'workspace',
48
command: filledCommand,
49
}),
50
51
WorkspaceSelectedCheckedFilled: defineFixture({
52
label: filledLabel,
53
target: 'workspace',
54
command: filledCommand,
55
runOn: WORKTREE_CREATED_RUN_ON,
56
}),
57
58
UserSelectedEmpty: defineFixture({
59
target: 'user',
60
}),
61
62
UserSelectedCheckedEmpty: defineFixture({
63
target: 'user',
64
runOn: WORKTREE_CREATED_RUN_ON,
65
}),
66
67
UserSelectedFilled: defineFixture({
68
label: filledLabel,
69
target: 'user',
70
command: filledCommand,
71
}),
72
73
UserSelectedCheckedFilled: defineFixture({
74
label: filledLabel,
75
target: 'user',
76
command: filledCommand,
77
runOn: WORKTREE_CREATED_RUN_ON,
78
}),
79
80
WorkspaceUnavailableEmpty: defineFixture({
81
target: 'user',
82
targetDisabledReason: workspaceUnavailableReason,
83
}),
84
85
WorkspaceUnavailableCheckedEmpty: defineFixture({
86
target: 'user',
87
targetDisabledReason: workspaceUnavailableReason,
88
runOn: WORKTREE_CREATED_RUN_ON,
89
}),
90
91
WorkspaceUnavailableFilled: defineFixture({
92
label: filledLabel,
93
target: 'user',
94
command: filledCommand,
95
targetDisabledReason: workspaceUnavailableReason,
96
}),
97
98
WorkspaceUnavailableCheckedFilled: defineFixture({
99
label: filledLabel,
100
target: 'user',
101
command: filledCommand,
102
targetDisabledReason: workspaceUnavailableReason,
103
runOn: WORKTREE_CREATED_RUN_ON,
104
}),
105
106
ExistingWorkspaceTaskLocked: defineFixture({
107
label: filledLabel,
108
labelDisabledReason: 'This name comes from an existing task and cannot be changed here.',
109
command: filledCommand,
110
commandDisabledReason: 'This command comes from an existing task and cannot be changed here.',
111
target: 'workspace',
112
targetDisabledReason: 'This existing task cannot be moved between workspace and user storage.',
113
}),
114
115
ExistingUserTaskLockedChecked: defineFixture({
116
label: filledLabel,
117
labelDisabledReason: 'This name comes from an existing task and cannot be changed here.',
118
command: filledCommand,
119
commandDisabledReason: 'This command comes from an existing task and cannot be changed here.',
120
target: 'user',
121
targetDisabledReason: 'This existing task cannot be moved between workspace and user storage.',
122
runOn: WORKTREE_CREATED_RUN_ON,
123
}),
124
});
125
126