mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 16:49:06 +01:00
@@ -251,15 +251,18 @@ suite('Webview tests', () => {
|
||||
});
|
||||
</script>`);
|
||||
|
||||
const workspaceRootUri = webview.webview.resourceRoot + vscode.Uri.file(vscode.workspace.rootPath!).path;
|
||||
async function toWebviewResource(path: string) {
|
||||
const root = await webview.webview.toWebviewResource(vscode.Uri.file(vscode.workspace.rootPath!));
|
||||
return root.toString() + path;
|
||||
}
|
||||
|
||||
{
|
||||
const imagePath = workspaceRootUri.toString() + '/image.png';
|
||||
const imagePath = await toWebviewResource('/image.png');
|
||||
const response = sendRecieveMessage(webview, { src: imagePath });
|
||||
assert.strictEqual((await response).value, true);
|
||||
}
|
||||
{
|
||||
const imagePath = workspaceRootUri.toString() + '/no-such-image.png';
|
||||
const imagePath = await toWebviewResource('/no-such-image.png');
|
||||
const response = sendRecieveMessage(webview, { src: imagePath });
|
||||
assert.strictEqual((await response).value, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user