notebook webview test

This commit is contained in:
rebornix
2020-05-20 13:19:16 -07:00
parent b3162f52c6
commit 627dd8b0ca
5 changed files with 72 additions and 1 deletions

View File

@@ -689,7 +689,7 @@ suite('regression', () => {
});
suite('webview resource uri', () => {
suite('webview', () => {
test('asWebviewUri', async function () {
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
@@ -698,4 +698,23 @@ suite('webview resource uri', () => {
assert.equal(uri.scheme, 'vscode-webview-resource');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
test('custom renderer message', async function () {
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './customRenderer.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
const editor = vscode.notebook.activeNotebookEditor;
const promise = new Promise(resolve => {
const messageEmitter = editor?.onDidReceiveMessage(e => {
if (e.type === 'custom_renderer_initialize') {
resolve();
messageEmitter?.dispose();
}
});
});
await vscode.commands.executeCommand('notebook.cell.execute');
await promise;
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
});