|
| 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 '../../../../browser/parts/media/editorPart.css'; |
| 7 | +import { $, append, Dimension } from '../../../../../base/browser/dom.js'; |
| 8 | +import { Event } from '../../../../../base/common/event.js'; |
| 9 | +import { mock } from '../../../../../base/test/common/mock.js'; |
| 10 | +import { ITextResourceConfigurationService } from '../../../../../editor/common/services/textResourceConfiguration.js'; |
| 11 | +import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js'; |
| 12 | +import { TestConfigurationService } from '../../../../../platform/configuration/test/common/testConfigurationService.js'; |
| 13 | +import { IFileService } from '../../../../../platform/files/common/files.js'; |
| 14 | +import { IEditorProgressService } from '../../../../../platform/progress/common/progress.js'; |
| 15 | +import { UriIdentityService } from '../../../../../platform/uriIdentity/common/uriIdentityService.js'; |
| 16 | +import { IUriIdentityService } from '../../../../../platform/uriIdentity/common/uriIdentity.js'; |
| 17 | +import { INotebookEditorService } from '../../../../../workbench/contrib/notebook/browser/services/notebookEditorService.js'; |
| 18 | +import { IReplaceService } from '../../../../../workbench/contrib/search/browser/replace.js'; |
| 19 | +import { SearchEditor } from '../../../../../workbench/contrib/searchEditor/browser/searchEditor.js'; |
| 20 | +import { IEditorGroupsService } from '../../../../../workbench/services/editor/common/editorGroupsService.js'; |
| 21 | +import { IEditorService } from '../../../../../workbench/services/editor/common/editorService.js'; |
| 22 | +import { ISearchService } from '../../../../../workbench/services/search/common/search.js'; |
| 23 | +import { INotebookSearchService } from '../../../../../workbench/contrib/search/common/notebookSearch.js'; |
| 24 | +import { ComponentFixtureContext, createEditorServices, defineComponentFixture, defineThemedFixtureGroup, registerWorkbenchServices } from '../../../../../workbench/test/browser/componentFixtures/fixtureUtils.js'; |
| 25 | +import { TestEditorGroupsService, TestEditorGroupView, TestEditorService, TestTextResourceConfigurationService } from '../../../../../workbench/test/browser/workbenchTestServices.js'; |
| 26 | +import { TestFileService } from '../../../../../workbench/test/common/workbenchTestServices.js'; |
| 27 | + |
| 28 | +function renderSearchEditor({ container, disposableStore, theme }: ComponentFixtureContext, compact: boolean): void { |
| 29 | + const width = 600; |
| 30 | + const height = 200; |
| 31 | + container.style.width = `${width}px`; |
| 32 | + container.style.height = `${height}px`; |
| 33 | + container.classList.add('agent-sessions-workbench', 'dock-detail-panel'); |
| 34 | + |
| 35 | + const part = append(container, $('.part.editor')); |
| 36 | + const groupContainer = append(part, $('.editor-group-container')); |
| 37 | + groupContainer.classList.toggle('editor-tabs-compact-height', compact); |
| 38 | + const group = new TestEditorGroupView(1); |
| 39 | + const configurationService = new TestConfigurationService({ |
| 40 | + editor: { minimap: { enabled: false } }, |
| 41 | + search: { searchOnType: false, searchEditor: { defaultNumberOfContextLines: 1 } }, |
| 42 | + }); |
| 43 | + const instantiationService = createEditorServices(disposableStore, { |
| 44 | + colorTheme: theme, |
| 45 | + additionalServices: reg => { |
| 46 | + registerWorkbenchServices(reg); |
| 47 | + reg.defineInstance(IConfigurationService, configurationService); |
| 48 | + reg.defineInstance(ITextResourceConfigurationService, new TestTextResourceConfigurationService(configurationService)); |
| 49 | + reg.defineInstance(IEditorGroupsService, new TestEditorGroupsService([group])); |
| 50 | + reg.define(IEditorService, TestEditorService); |
| 51 | + reg.define(IFileService, TestFileService); |
| 52 | + reg.define(IUriIdentityService, UriIdentityService); |
| 53 | + reg.defineInstance(IEditorProgressService, new class extends mock<IEditorProgressService>() { }()); |
| 54 | + reg.defineInstance(ISearchService, new class extends mock<ISearchService>() { }()); |
| 55 | + reg.defineInstance(INotebookSearchService, new class extends mock<INotebookSearchService>() { }()); |
| 56 | + reg.defineInstance(IReplaceService, new class extends mock<IReplaceService>() { }()); |
| 57 | + reg.definePartialInstance(INotebookEditorService, { onDidAddNotebookEditor: Event.None }); |
| 58 | + }, |
| 59 | + }); |
| 60 | + const editor = disposableStore.add(instantiationService.createInstance(SearchEditor, group)); |
| 61 | + editor.create(groupContainer); |
| 62 | + editor.layout(new Dimension(width, height)); |
| 63 | +} |
| 64 | + |
| 65 | +export default defineThemedFixtureGroup({ path: 'sessions/' }, { |
| 66 | + Default: defineComponentFixture({ |
| 67 | + labels: { kind: 'screenshot' }, |
| 68 | + additionalThemes: ['darkHighContrast'], |
| 69 | + expectedVisualDescriptions: ['The search input and context controls have visible breathing room above and below them, separating the controls from the horizontal results separator.'], |
| 70 | + render: context => renderSearchEditor(context, false), |
| 71 | + }), |
| 72 | + Compact: defineComponentFixture({ |
| 73 | + labels: { kind: 'screenshot' }, |
| 74 | + additionalThemes: ['darkHighContrast'], |
| 75 | + expectedVisualDescriptions: ['With compact editor tabs, the full-height search controls retain the same vertical breathing room and separation from the results separator as with default editor tabs.'], |
| 76 | + render: context => renderSearchEditor(context, true), |
| 77 | + }), |
| 78 | +}); |
0 commit comments