Commit 1ff2ac38 authored by Phil Hughes's avatar Phil Hughes

Fixed IDE changed files not reseting after commit

Closes #5094
parent fa2c63ea
...@@ -94,6 +94,8 @@ export const updateFilesAfterCommit = ( ...@@ -94,6 +94,8 @@ export const updateFilesAfterCommit = (
raw: entry.content, raw: entry.content,
}, { root: true }); }, { root: true });
commit(rootTypes.DISCARD_FILE_CHANGES, entry, { root: true });
eventHub.$emit(`editor.update.model.content.${entry.path}`, entry.raw); eventHub.$emit(`editor.update.model.content.${entry.path}`, entry.raw);
}); });
......
...@@ -178,6 +178,7 @@ describe('IDE commit module actions', () => { ...@@ -178,6 +178,7 @@ describe('IDE commit module actions', () => {
f = file('changedFile'); f = file('changedFile');
Object.assign(f, { Object.assign(f, {
active: true, active: true,
changed: true,
content: 'file content', content: 'file content',
}); });
...@@ -191,8 +192,11 @@ describe('IDE commit module actions', () => { ...@@ -191,8 +192,11 @@ describe('IDE commit module actions', () => {
}, },
}, },
}; };
store.state.changedFiles.push(f); store.state.changedFiles.push(f, {
store.state.openFiles.push(f); ...file('changedFile2'),
changed: true,
});
store.state.openFiles = store.state.changedFiles;
}); });
it('updates stores working reference', (done) => { it('updates stores working reference', (done) => {
...@@ -209,6 +213,20 @@ describe('IDE commit module actions', () => { ...@@ -209,6 +213,20 @@ describe('IDE commit module actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('resets all files changed status', (done) => {
store.dispatch('commit/updateFilesAfterCommit', {
data,
branch,
})
.then(() => {
store.state.openFiles.forEach((entry) => {
expect(entry.changed).toBeFalsy();
});
})
.then(done)
.catch(done.fail);
});
it('removes all changed files', (done) => { it('removes all changed files', (done) => {
store.dispatch('commit/updateFilesAfterCommit', { store.dispatch('commit/updateFilesAfterCommit', {
data, data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment