Add ability to open untitled document with initial content (#22021)

This commit is contained in:
Cody Hoover
2017-03-07 07:43:21 +01:00
committed by Benjamin Pasero
parent 1dd884a88a
commit 503f8f516e
9 changed files with 31 additions and 16 deletions

View File

@@ -100,6 +100,15 @@ suite('workspace-namespace', () => {
});
});
test('openTextDocument, untitled without path but language ID and contents', function () {
return workspace.openTextDocument({ language: 'html', contents: '<h1>Hello world!</h1>' }).then(doc => {
assert.equal(doc.uri.scheme, 'untitled');
assert.equal(doc.languageId, 'html');
assert.ok(doc.isDirty);
assert.equal(doc.getText(), '<h1>Hello world!</h1>');
});
});
test('openTextDocument, untitled closes on save', function (done) {
const path = join(workspace.rootPath || '', './newfile.txt');