Finalize asWebviewUri api

Fixes #79242

As discussed, renames `toWebviewResource` to `asWebviewUri` to be consistent with the `asAbsolutePath` api naming
This commit is contained in:
Matt Bierner
2019-08-19 20:18:26 -07:00
parent 7af2ebb9fc
commit c5dc9d16be
10 changed files with 59 additions and 66 deletions

View File

@@ -251,18 +251,18 @@ suite('Webview tests', () => {
});
</script>`);
async function toWebviewResource(path: string) {
const root = await webview.webview.toWebviewResource(vscode.Uri.file(vscode.workspace.rootPath!));
async function asWebviewUri(path: string) {
const root = await webview.webview.asWebviewUri(vscode.Uri.file(vscode.workspace.rootPath!));
return root.toString() + path;
}
{
const imagePath = await toWebviewResource('/image.png');
const imagePath = await asWebviewUri('/image.png');
const response = sendRecieveMessage(webview, { src: imagePath });
assert.strictEqual((await response).value, true);
}
{
const imagePath = await toWebviewResource('/no-such-image.png');
const imagePath = await asWebviewUri('/no-such-image.png');
const response = sendRecieveMessage(webview, { src: imagePath });
assert.strictEqual((await response).value, false);
}