未验证 提交 a7285b47 编写于 作者: M Matt Bierner 提交者: GitHub

Enable webview tests on remote as well (#102444)

* Enable webview tests on remote as well

* Delete conditional test type
上级 3ef3c105
......@@ -7,7 +7,7 @@ import * as assert from 'assert';
import 'mocha';
import * as os from 'os';
import * as vscode from 'vscode';
import { closeAllEditors, conditionalTest, delay, disposeAll } from '../utils';
import { closeAllEditors, delay, disposeAll } from '../utils';
const webviewId = 'myWebview';
......@@ -86,7 +86,7 @@ suite('vscode API - webview', () => {
}
});
conditionalTest('webviews should preserve vscode API state when they are hidden', async () => {
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);
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
......@@ -129,7 +129,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(secondResponse.value, 1);
});
conditionalTest('webviews should preserve their context when they are moved between view columns', async () => {
test('webviews should preserve their context when they are moved between view columns', async () => {
const doc = await vscode.workspace.openTextDocument(testDocument);
await vscode.window.showTextDocument(doc, vscode.ViewColumn.One);
......@@ -150,7 +150,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(secondResponse.value, 1);
});
conditionalTest('webviews with retainContextWhenHidden should preserve their context when they are hidden', async () => {
test('webviews with retainContextWhenHidden should preserve their context when they are hidden', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMesssage(webview);
......@@ -172,7 +172,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(secondResponse.value, 1);
});
conditionalTest('webviews with retainContextWhenHidden should preserve their page position when hidden', async () => {
test('webviews with retainContextWhenHidden should preserve their page position when hidden', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMesssage(webview);
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
......@@ -212,7 +212,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(Math.round(secondResponse.value), 100);
});
conditionalTest('webviews with retainContextWhenHidden should be able to recive messages while hidden', async () => {
test('webviews with retainContextWhenHidden should be able to recive messages while hidden', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMesssage(webview);
......@@ -239,7 +239,7 @@ suite('vscode API - webview', () => {
});
conditionalTest('webviews should only be able to load resources from workspace by default', async () => {
test('webviews should only be able to load resources from workspace by default', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', {
viewColumn: vscode.ViewColumn.One
}, {
......@@ -284,7 +284,7 @@ suite('vscode API - webview', () => {
}
});
conditionalTest('webviews should allow overriding allowed resource paths using localResourceRoots', async () => {
test('webviews should allow overriding allowed resource paths using localResourceRoots', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, {
enableScripts: true,
localResourceRoots: [workspaceFile('sub')]
......@@ -312,7 +312,7 @@ suite('vscode API - webview', () => {
}
});
conditionalTest('webviews using hard-coded old style vscode-resource uri should work', async () => {
test('webviews using hard-coded old style vscode-resource uri should work', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, {
enableScripts: true,
localResourceRoots: [workspaceFile('sub')]
......@@ -366,7 +366,7 @@ suite('vscode API - webview', () => {
});
if (os.platform() === 'darwin') {
conditionalTest('webview can copy text from webview', async () => {
test('webview can copy text from webview', async () => {
const expectedText = `webview text from: ${Date.now()}!`;
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
......
......@@ -56,21 +56,6 @@ export function disposeAll(disposables: vscode.Disposable[]) {
vscode.Disposable.from(...disposables).dispose();
}
export function conditionalTest(name: string, testCallback: (done: MochaDone) => void | Thenable<any>) {
if (isTestTypeActive()) {
const async = !!testCallback.length;
if (async) {
test(name, (done) => testCallback(done));
} else {
test(name, () => (<() => void | Thenable<any>>testCallback)());
}
}
}
function isTestTypeActive(): boolean {
return !!vscode.extensions.getExtension('vscode-resolver-test');
}
export function delay(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册