Merge branch 'ide-row-hover-scroll' into 'master'
Fixed IDE file row jumping into view on hover Closes #50751 See merge request gitlab-org/gitlab-ce!21403
This commit is contained in:
commit
bdae30d8fb
3 changed files with 33 additions and 5 deletions
|
@ -95,16 +95,18 @@ export default {
|
|||
return this.file.changed || this.file.tempFile || this.file.staged;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'file.active': function fileActiveWatch(active) {
|
||||
if (this.file.type === 'blob' && active) {
|
||||
this.scrollIntoView();
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.hasPathAtCurrentRoute()) {
|
||||
this.scrollIntoView(true);
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
if (this.file.type === 'blob' && this.file.active) {
|
||||
this.scrollIntoView();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['toggleTreeOpen']),
|
||||
clickFile() {
|
||||
|
|
5
changelogs/unreleased/ide-row-hover-scroll.yml
Normal file
5
changelogs/unreleased/ide-row-hover-scroll.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fixed IDE file row scrolling into view when hovering
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -121,4 +121,25 @@ describe('RepoFile', () => {
|
|||
).toContain('Locked by testuser');
|
||||
});
|
||||
});
|
||||
|
||||
it('calls scrollIntoView if made active', done => {
|
||||
createComponent({
|
||||
file: {
|
||||
...file(),
|
||||
type: 'blob',
|
||||
active: false,
|
||||
},
|
||||
level: 0,
|
||||
});
|
||||
|
||||
spyOn(vm, 'scrollIntoView');
|
||||
|
||||
vm.file.active = true;
|
||||
|
||||
vm.$nextTick(() => {
|
||||
expect(vm.scrollIntoView).toHaveBeenCalled();
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue