Path: blob/main/src/vs/sessions/contrib/chat/test/browser/runScriptCustomTaskWidget.fixture.ts
13405 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ComponentFixtureContext, defineComponentFixture, defineThemedFixtureGroup } from '../../../../../workbench/test/browser/componentFixtures/fixtureUtils.js';6import { IRunScriptCustomTaskWidgetState, RunScriptCustomTaskWidget, WORKTREE_CREATED_RUN_ON } from '../../browser/runScriptCustomTaskWidget.js';78// Ensure color registrations are loaded9import '../../../../common/theme.js';10import '../../../../../platform/theme/common/colors/inputColors.js';1112const filledLabel = 'Start Dev Server';13const filledCommand = 'npm run dev';14const workspaceUnavailableReason = 'Workspace storage is unavailable for this session';1516function renderWidget(ctx: ComponentFixtureContext, state: IRunScriptCustomTaskWidgetState): void {17ctx.container.style.width = '600px';18ctx.container.style.padding = '0';19ctx.container.style.borderRadius = 'var(--vscode-cornerRadius-xLarge)';20ctx.container.style.backgroundColor = 'var(--vscode-quickInput-background)';21ctx.container.style.overflow = 'hidden';2223const widget = ctx.disposableStore.add(new RunScriptCustomTaskWidget(state));24ctx.container.appendChild(widget.domNode);25}2627function defineFixture(state: IRunScriptCustomTaskWidgetState) {28return defineComponentFixture({29labels: { kind: 'screenshot' },30render: ctx => renderWidget(ctx, state),31});32}3334export default defineThemedFixtureGroup({ path: 'sessions/' }, {35WorkspaceSelectedEmpty: defineFixture({36target: 'workspace',37}),3839WorkspaceSelectedCheckedEmpty: defineFixture({40target: 'workspace',41runOn: WORKTREE_CREATED_RUN_ON,42}),4344WorkspaceSelectedFilled: defineFixture({45label: filledLabel,46target: 'workspace',47command: filledCommand,48}),4950WorkspaceSelectedCheckedFilled: defineFixture({51label: filledLabel,52target: 'workspace',53command: filledCommand,54runOn: WORKTREE_CREATED_RUN_ON,55}),5657UserSelectedEmpty: defineFixture({58target: 'user',59}),6061UserSelectedCheckedEmpty: defineFixture({62target: 'user',63runOn: WORKTREE_CREATED_RUN_ON,64}),6566UserSelectedFilled: defineFixture({67label: filledLabel,68target: 'user',69command: filledCommand,70}),7172UserSelectedCheckedFilled: defineFixture({73label: filledLabel,74target: 'user',75command: filledCommand,76runOn: WORKTREE_CREATED_RUN_ON,77}),7879WorkspaceUnavailableEmpty: defineFixture({80target: 'user',81targetDisabledReason: workspaceUnavailableReason,82}),8384WorkspaceUnavailableCheckedEmpty: defineFixture({85target: 'user',86targetDisabledReason: workspaceUnavailableReason,87runOn: WORKTREE_CREATED_RUN_ON,88}),8990WorkspaceUnavailableFilled: defineFixture({91label: filledLabel,92target: 'user',93command: filledCommand,94targetDisabledReason: workspaceUnavailableReason,95}),9697WorkspaceUnavailableCheckedFilled: defineFixture({98label: filledLabel,99target: 'user',100command: filledCommand,101targetDisabledReason: workspaceUnavailableReason,102runOn: WORKTREE_CREATED_RUN_ON,103}),104105ExistingWorkspaceTaskLocked: defineFixture({106label: filledLabel,107labelDisabledReason: 'This name comes from an existing task and cannot be changed here.',108command: filledCommand,109commandDisabledReason: 'This command comes from an existing task and cannot be changed here.',110target: 'workspace',111targetDisabledReason: 'This existing task cannot be moved between workspace and user storage.',112}),113114ExistingUserTaskLockedChecked: defineFixture({115label: filledLabel,116labelDisabledReason: 'This name comes from an existing task and cannot be changed here.',117command: filledCommand,118commandDisabledReason: 'This command comes from an existing task and cannot be changed here.',119target: 'user',120targetDisabledReason: 'This existing task cannot be moved between workspace and user storage.',121runOn: WORKTREE_CREATED_RUN_ON,122}),123});124125126