add html preview sample
This commit is contained in:
parent
79e032c169
commit
a6aa8ddf80
|
@ -6,8 +6,7 @@
|
|||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {commands} from 'vscode';
|
||||
import {join} from 'path';
|
||||
import {commands, workspace, Uri} from 'vscode';
|
||||
|
||||
suite("commands namespace tests", () => {
|
||||
|
||||
|
@ -39,4 +38,21 @@ suite("commands namespace tests", () => {
|
|||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('api-command: workbench.html.preview', function() {
|
||||
|
||||
let registration = workspace.registerTextDocumentContentProvider('speciale', {
|
||||
provideTextDocumentContent(uri) {
|
||||
return `content of URI <b>${uri.toString()}</b>`;
|
||||
}
|
||||
});
|
||||
|
||||
let virtualDocumentUri = Uri.parse('speciale://authority/path')
|
||||
|
||||
return commands.executeCommand('workbench.html.preview', virtualDocumentUri).then(success => {
|
||||
assert.ok(success);
|
||||
registration.dispose();
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
|
|
|
@ -26,9 +26,10 @@ suite('workspace-namespace', () => {
|
|||
});
|
||||
|
||||
test('openTextDocument', () => {
|
||||
let len = workspace.textDocuments.length
|
||||
return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => {
|
||||
assert.ok(doc);
|
||||
assert.equal(workspace.textDocuments.length, 1);
|
||||
assert.equal(workspace.textDocuments.length, len + 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue