mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Add ability to open untitled document with initial content (#22021)
This commit is contained in:
committed by
Benjamin Pasero
parent
1dd884a88a
commit
503f8f516e
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user