mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 09:38:26 -05:00
Notebook Views initialization fix (#17109)
Separate the Views load from the initialization. This way we can load previously created views, and only add the new views data to the document when needed. For now, this happens only when a view is created.
This commit is contained in:
@@ -208,7 +208,7 @@ suite('NotebookViewModel', function (): void {
|
||||
viewModel.initialize();
|
||||
|
||||
let cell = viewModel.cells[0];
|
||||
let cellMeta = notebookViews.getCellMetadata(cell);
|
||||
let cellMeta = notebookViews.getExtensionCellMetadata(cell);
|
||||
|
||||
assert(!isUndefinedOrNull(cellMeta.views.find(v => v.guid === viewModel.guid)));
|
||||
assert.deepStrictEqual(viewModel.getCellMetadata(cell), cellMeta.views.find(v => v.guid === viewModel.guid));
|
||||
|
||||
@@ -76,6 +76,19 @@ suite('NotebookViews', function (): void {
|
||||
notebookViews = await initializeExtension();
|
||||
});
|
||||
|
||||
test('should not modify the notebook document until a view is created', async () => {
|
||||
//Create some content
|
||||
notebookViews.notebook.addCell(CellTypes.Code, 0);
|
||||
const cell = notebookViews.notebook.cells[0];
|
||||
|
||||
assert.strictEqual(notebookViews.getExtensionMetadata(), undefined);
|
||||
assert.strictEqual(notebookViews.getExtensionCellMetadata(cell), undefined);
|
||||
|
||||
//Check that the view is created
|
||||
notebookViews.createNewView(defaultViewName);
|
||||
assert.notStrictEqual(notebookViews.getExtensionMetadata(), undefined);
|
||||
});
|
||||
|
||||
test('create new view', async function (): Promise<void> {
|
||||
assert.strictEqual(notebookViews.getViews().length, 0, 'notebook should not initially generate any views');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user