From af3373bc4b081799262c1b980b362189f2e5c5bb Mon Sep 17 00:00:00 2001 From: Maddy <12754347+MaddyDev@users.noreply.github.com> Date: Mon, 1 Mar 2021 14:14:00 -0800 Subject: [PATCH] check for isDirty false explicitly (#14427) * check for isDirty false explicitly * revert back test to not pass isDirty --- .../notebook/browser/models/notebookInput.ts | 2 +- .../notebookEditorModel.test.ts | 33 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts b/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts index afd0b3c44c..1780300713 100644 --- a/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts +++ b/src/sql/workbench/contrib/notebook/browser/models/notebookInput.ts @@ -122,7 +122,7 @@ export class NotebookEditorModel extends EditorModel { this._isFirstKernelChange = false; return; } - if (!contentChange?.isDirty) { + if (!contentChange?.isDirty === false) { return; } this._lastEditFullReplacement = false; diff --git a/src/sql/workbench/contrib/notebook/test/electron-browser/notebookEditorModel.test.ts b/src/sql/workbench/contrib/notebook/test/electron-browser/notebookEditorModel.test.ts index 28fe2902fd..e1f56f0941 100644 --- a/src/sql/workbench/contrib/notebook/test/electron-browser/notebookEditorModel.test.ts +++ b/src/sql/workbench/contrib/notebook/test/electron-browser/notebookEditorModel.test.ts @@ -191,7 +191,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -216,7 +215,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -228,7 +226,6 @@ suite('Notebook Editor Model', function (): void { newCell.executionCount = 1; contentChange = { changeType: NotebookChangeType.CellExecuted, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -246,7 +243,6 @@ suite('Notebook Editor Model', function (): void { newCell.executionCount = 10; contentChange = { changeType: NotebookChangeType.CellExecuted, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -258,7 +254,6 @@ suite('Notebook Editor Model', function (): void { newCell.executionCount = 15; contentChange = { changeType: NotebookChangeType.CellExecuted, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -270,7 +265,6 @@ suite('Notebook Editor Model', function (): void { newCell.executionCount = 105; contentChange = { changeType: NotebookChangeType.CellExecuted, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -289,7 +283,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -300,7 +293,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellOutputCleared, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -325,7 +317,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -336,7 +327,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -373,7 +363,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -384,7 +373,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -419,7 +407,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -432,7 +419,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: undefined @@ -461,7 +447,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -474,7 +459,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: undefined @@ -504,7 +488,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -518,7 +501,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -536,7 +518,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -571,7 +552,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -581,7 +561,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -606,7 +585,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: { @@ -646,7 +624,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [cell], cellIndex: 0 }; @@ -656,7 +633,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], modelContentChangedEvent: { changes: [{ range: new Range(1, 1, 1, 1), rangeLength: 0, rangeOffset: 0, text: 'This is a test' }], @@ -695,7 +671,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -708,7 +683,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellOutputUpdated, - isDirty: true, cells: [newCell] }; @@ -734,7 +708,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -749,7 +722,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellOutputUpdated, - isDirty: true, cells: [newCell] }; @@ -772,7 +744,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellOutputUpdated, - isDirty: true, cells: [newCell] }; @@ -801,7 +772,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -816,7 +786,6 @@ suite('Notebook Editor Model', function (): void { contentChange = { changeType: NotebookChangeType.CellOutputUpdated, - isDirty: true, cells: [newCell] }; @@ -1017,7 +986,6 @@ suite('Notebook Editor Model', function (): void { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellsModified, - isDirty: true, cells: [newCell], cellIndex: 0 }; @@ -1031,7 +999,6 @@ suite('Notebook Editor Model', function (): void { function addTextToBeginningOfTextEditorModel(notebookEditorModel: NotebookEditorModel, newCell: ICellModel, textToAdd: string) { let contentChange: NotebookContentChange = { changeType: NotebookChangeType.CellSourceUpdated, - isDirty: true, cells: [newCell], cellIndex: 0, modelContentChangedEvent: {