BigW Consortium Gitlab

Commit 1d77de47 by Filipa Lacerda

Merge branch 'ide-commit-state-bug' into 'master'

Fixed web IDE review & commit editors getting into incorrect state Closes #46392 See merge request gitlab-org/gitlab-ce!19038
parent 8c22568d
......@@ -43,9 +43,13 @@ export default {
},
},
watch: {
file(oldVal, newVal) {
file(newVal, oldVal) {
if (oldVal.pending) {
this.removePendingTab(oldVal);
}
// Compare key to allow for files opened in review mode to be cached differently
if (newVal.key !== this.file.key) {
if (oldVal.key !== this.file.key) {
this.initMonaco();
if (this.currentActivityView !== activityBarViews.edit) {
......@@ -99,6 +103,7 @@ export default {
'setFileViewMode',
'setFileEOL',
'updateViewer',
'removePendingTab',
]),
initMonaco() {
if (this.shouldHideEditor) return;
......
......@@ -346,4 +346,24 @@ describe('RepoEditor', () => {
});
});
});
it('calls removePendingTab when old file is pending', done => {
spyOnProperty(vm, 'shouldHideEditor').and.returnValue(true);
spyOn(vm, 'removePendingTab');
vm.file.pending = true;
vm
.$nextTick()
.then(() => {
vm.file = file('testing');
return vm.$nextTick();
})
.then(() => {
expect(vm.removePendingTab).toHaveBeenCalled();
})
.then(done)
.catch(done.fail);
});
});
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