mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 21:52:24 +00:00
Add pinning test for webview html update
This commit is contained in:
parent
676ea4b5c5
commit
23fedc5a3e
1 changed files with 25 additions and 0 deletions
|
@ -47,6 +47,31 @@ suite('Webview tests', () => {
|
|||
assert.strictEqual((await firstResponse).value, 2);
|
||||
});
|
||||
|
||||
test('webviews should update html', async () => {
|
||||
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true }));
|
||||
|
||||
{
|
||||
const response = getMesssage(webview);
|
||||
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
vscode.postMessage({ value: 'first' });
|
||||
</script>`);
|
||||
|
||||
assert.strictEqual((await response).value, 'first');
|
||||
}
|
||||
{
|
||||
const firstResponse = getMesssage(webview);
|
||||
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
vscode.postMessage({ value: 'second' });
|
||||
</script>`);
|
||||
|
||||
assert.strictEqual((await firstResponse).value, 'second');
|
||||
}
|
||||
});
|
||||
|
||||
test('webviews should preserve vscode API state when they are hidden', async () => {
|
||||
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true }));
|
||||
const ready = getMesssage(webview);
|
||||
|
|
Loading…
Reference in a new issue