Update run w/parameters icon and increment parameterized notebook (#15127)

* update icon and increment parameterized notebook
This commit is contained in:
Vasu Bhog
2021-04-14 15:28:27 -07:00
committed by GitHub
parent e7571410e0
commit 3a1885491f
6 changed files with 39 additions and 4 deletions

View File

@@ -364,8 +364,8 @@ export class RunParametersAction extends TooltipFromLabelAction {
public async openParameterizedNotebook(uri: URI): Promise<void> {
const editor = this._notebookService.findNotebookEditor(uri);
let modelContents = JSON.stringify(editor.model.toJSON());
let basename = path.basename(uri.fsPath);
let untitledUri = uri.with({ authority: '', scheme: 'untitled', path: basename });
let untitledUriPath = this._notebookService.getUntitledUriPath(path.basename(uri.fsPath));
let untitledUri = uri.with({ authority: '', scheme: 'untitled', path: untitledUriPath });
this._notebookService.openNotebook(untitledUri, {
initialContent: modelContents,
preserveFocus: true

View File

@@ -561,6 +561,14 @@ suite.skip('NotebookService:', function (): void {
mock.verifyAll();
});
test('verify getUntitledUriPath gets the proper next title', () => {
let getUntitledUriPathSpy = sinon.spy(notebookService, 'getUntitledUriPath');
notebookService.getUntitledUriPath('title.ipynb');
sinon.assert.calledOnce(getUntitledUriPathSpy);
assert.equal(getUntitledUriPathSpy, 'title-0.ipynb');
});
});
function unRegisterProviders(notebookService: NotebookService) {

View File

@@ -303,6 +303,9 @@ export class NotebookServiceStub implements INotebookService {
notifyCellExecutionStarted(): void {
throw new Error('Method not implemented.');
}
getUntitledUriPath(originalTitle: string): string {
throw new Error('Method not implemented.');
}
}
export class ClientSessionStub implements IClientSession {