diff --git a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts index df3529e747..d65b193fe5 100644 --- a/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/cellViews/textCell.component.ts @@ -195,7 +195,6 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges { this._register(this.themeService.onDidColorThemeChange(this.updateTheme, this)); this.updateTheme(this.themeService.getColorTheme()); this.setFocusAndScroll(); - this.cellModel.isEditMode = false; this._htmlMarkdownConverter = this._instantiationService.createInstance(HTMLMarkdownConverter, this.notebookUri); this._register(this.cellModel.onOutputsChanged(e => { this.updatePreview(); diff --git a/test/smoke/src/sql/areas/notebook/notebook.test.ts b/test/smoke/src/sql/areas/notebook/notebook.test.ts index c1bc77b684..db1e4e4789 100644 --- a/test/smoke/src/sql/areas/notebook/notebook.test.ts +++ b/test/smoke/src/sql/areas/notebook/notebook.test.ts @@ -274,35 +274,42 @@ export function setup(opts: minimist.ParsedArgs) { describe('Cell Toolbar Actions', function () { async function verifyCellToolbarBehavior(app: Application, toolbarAction: () => Promise, selector: string, checkIfGone: boolean = false): Promise { - const sampleText: string = 'Test Text'; + // Run the test for each of the default text editor modes + for (let editMode of ['Markdown', 'Split View']) { + await app.workbench.settingsEditor.addUserSetting('notebook.defaultTextEditMode', `"${editMode}"`); + await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); + await app.workbench.sqlNotebook.newUntitledNotebook(); + await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown'); + let sampleText = `Markdown Toolbar Test - ${editMode}`; + await app.workbench.sqlNotebook.waitForTypeInEditor(sampleText); + await app.workbench.sqlNotebook.selectAllTextInEditor(); - await app.workbench.sqlNotebook.newUntitledNotebook(); - await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown'); - await app.workbench.sqlNotebook.waitForPlaceholderGone(); - await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Split View'); - await app.workbench.sqlNotebook.waitForTypeInEditor(sampleText); - await app.workbench.sqlNotebook.selectAllTextInEditor(); - - await toolbarAction(); - await app.code.dispatchKeybinding('escape'); - if (checkIfGone) { - await app.workbench.sqlNotebook.waitForTextCellPreviewContentGone(selector); - } else { - await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, selector); + await toolbarAction(); + await app.code.dispatchKeybinding('escape'); + if (checkIfGone) { + await app.workbench.sqlNotebook.waitForTextCellPreviewContentGone(selector); + } else { + await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, selector); + } + await app.workbench.quickaccess.runCommand('workbench.action.revertAndCloseActiveEditor'); } } async function verifyToolbarKeyboardShortcut(app: Application, keyboardShortcut: string, selector: string) { - await app.workbench.sqlNotebook.newUntitledNotebook(); - await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown'); - await app.workbench.sqlNotebook.waitForPlaceholderGone(); - await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Markdown View'); - let testText = 'Markdown Keyboard Shortcut Test'; - await app.workbench.sqlNotebook.waitForTypeInEditor(testText); - await app.workbench.sqlNotebook.selectAllTextInEditor(); - await app.code.dispatchKeybinding(keyboardShortcut); - await app.code.dispatchKeybinding('escape'); - await app.workbench.sqlNotebook.waitForTextCellPreviewContent(testText, selector); + // Run the test for each of the default text editor modes + for (let editMode of ['Markdown', 'Split View']) { + await app.workbench.settingsEditor.addUserSetting('notebook.defaultTextEditMode', `"${editMode}"`); + await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); + await app.workbench.sqlNotebook.newUntitledNotebook(); + await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown'); + let testText = `Markdown Keyboard Shortcut Test - ${editMode}`; + await app.workbench.sqlNotebook.waitForTypeInEditor(testText); + await app.workbench.sqlNotebook.selectAllTextInEditor(); + await app.code.dispatchKeybinding(keyboardShortcut); + await app.code.dispatchKeybinding('escape'); + await app.workbench.sqlNotebook.waitForTextCellPreviewContent(testText, selector); + await app.workbench.quickaccess.runCommand('workbench.action.revertAndCloseActiveEditor'); + } } it('can bold selected text', async function () {