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
This commit is contained in:
commit
3a3f542db6
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue