提交 2a3dc1ed 编写于 作者: B Benjamin Pasero

fix tests

上级 a6280584
...@@ -109,14 +109,9 @@ export class MainThreadDocuments implements MainThreadDocumentsShape { ...@@ -109,14 +109,9 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
this._proxy.$acceptModelSaved(e.model.resource); this._proxy.$acceptModelSaved(e.model.resource);
} }
})); }));
this._toDispose.add(textFileService.models.onDidRevert(m => {
if (this._shouldHandleFileEvent(m.resource)) {
this._proxy.$acceptDirtyStateChanged(m.resource, false);
}
}));
this._toDispose.add(textFileService.models.onDidChangeDirty(m => { this._toDispose.add(textFileService.models.onDidChangeDirty(m => {
if (this._shouldHandleFileEvent(m.resource)) { if (this._shouldHandleFileEvent(m.resource)) {
this._proxy.$acceptDirtyStateChanged(m.resource, true); this._proxy.$acceptDirtyStateChanged(m.resource, m.isDirty());
} }
})); }));
......
...@@ -134,7 +134,8 @@ suite('Files - TextFileEditorModelManager', () => { ...@@ -134,7 +134,8 @@ suite('Files - TextFileEditorModelManager', () => {
const resource2 = toResource.call(this, '/path/other.txt'); const resource2 = toResource.call(this, '/path/other.txt');
let loadedCounter = 0; let loadedCounter = 0;
let dirtyCounter = 0; let gotDirtyCounter = 0;
let gotNonDirtyCounter = 0;
let revertedCounter = 0; let revertedCounter = 0;
let savedCounter = 0; let savedCounter = 0;
let encodingCounter = 0; let encodingCounter = 0;
...@@ -147,7 +148,11 @@ suite('Files - TextFileEditorModelManager', () => { ...@@ -147,7 +148,11 @@ suite('Files - TextFileEditorModelManager', () => {
manager.onDidChangeDirty(model => { manager.onDidChangeDirty(model => {
if (model.resource.toString() === resource1.toString()) { if (model.resource.toString() === resource1.toString()) {
dirtyCounter++; if (model.isDirty()) {
gotDirtyCounter++;
} else {
gotNonDirtyCounter++;
}
} }
}); });
...@@ -189,7 +194,8 @@ suite('Files - TextFileEditorModelManager', () => { ...@@ -189,7 +194,8 @@ suite('Files - TextFileEditorModelManager', () => {
model2.dispose(); model2.dispose();
await model1.revert(); await model1.revert();
assert.equal(dirtyCounter, 4); assert.equal(gotDirtyCounter, 2);
assert.equal(gotNonDirtyCounter, 2);
assert.equal(revertedCounter, 1); assert.equal(revertedCounter, 1);
assert.equal(savedCounter, 1); assert.equal(savedCounter, 1);
assert.equal(encodingCounter, 2); assert.equal(encodingCounter, 2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册