Add an option to disable closing open files that are removed from the directory (#21962)

This commit is contained in:
Benjamin Pasero
2017-03-06 11:26:56 +01:00
committed by GitHub
parent 4c2600fd3f
commit 16b59a51d4
13 changed files with 344 additions and 267 deletions
@@ -210,31 +210,6 @@ suite('Files - TextFileEditorModel', () => {
}, error => onError(error, done));
});
test('Conflict Resolution Mode', function (done) {
const model: TextFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/index_async.txt'), 'utf8');
model.load().done(() => {
model.setConflictResolutionMode();
model.textEditorModel.setValue('foo');
assert.ok(model.isDirty());
assert.equal(model.getState(), ModelState.CONFLICT);
return model.revert().then(() => {
model.textEditorModel.setValue('bar');
assert.ok(model.isDirty());
return model.save().then(() => {
assert.ok(!model.isDirty());
model.dispose();
done();
});
});
}, error => onError(error, done));
});
test('Auto Save triggered when model changes', function (done) {
let eventCounter = 0;
const model: TextFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/index.txt'), 'utf8');
@@ -382,6 +357,25 @@ suite('Files - TextFileEditorModel', () => {
}, error => onError(error, done));
});
test('setOrphaned basics', function (done) {
const model: TextFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/index_async.txt'), 'utf8');
return model.load().then(() => {
let undo = model.setOrphaned();
assert.equal(model.isDirty(), true);
undo();
assert.equal(model.isDirty(), false);
// can not undo when model changed meanwhile
undo = model.setOrphaned();
model.textEditorModel.setValue('foo');
undo();
assert.equal(model.isDirty(), true);
done();
}, error => onError(error, done));
});
test('SaveSequentializer - pending basics', function (done) {
const sequentializer = new SaveSequentializer();