Commit 7da7af3a authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ide-tab-active-click-fix' into 'master'

Fixed the IDE commit list item loosing its active state

Closes #48125

See merge request gitlab-org/gitlab-ce!20138
parents cab5374b bc955da8
...@@ -44,6 +44,8 @@ export default { ...@@ -44,6 +44,8 @@ export default {
methods: { methods: {
...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']), ...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']),
clickFile(tab) { clickFile(tab) {
if (tab.active) return;
this.updateDelayViewerUpdated(true); this.updateDelayViewerUpdated(true);
if (tab.pending) { if (tab.pending) {
......
...@@ -38,6 +38,26 @@ describe('RepoTab', () => { ...@@ -38,6 +38,26 @@ describe('RepoTab', () => {
expect(name.textContent.trim()).toEqual(vm.tab.name); expect(name.textContent.trim()).toEqual(vm.tab.name);
}); });
it('does not call openPendingTab when tab is active', done => {
vm = createComponent({
tab: {
...file(),
pending: true,
active: true,
},
});
spyOn(vm, 'openPendingTab');
vm.$el.click();
vm.$nextTick(() => {
expect(vm.openPendingTab).not.toHaveBeenCalled();
done();
});
});
it('fires clickFile when the link is clicked', () => { it('fires clickFile when the link is clicked', () => {
vm = createComponent({ vm = createComponent({
tab: file(), tab: file(),
...@@ -112,9 +132,9 @@ describe('RepoTab', () => { ...@@ -112,9 +132,9 @@ describe('RepoTab', () => {
}); });
it('renders a tooltip', () => { it('renders a tooltip', () => {
expect( expect(vm.$el.querySelector('span:nth-child(2)').dataset.originalTitle).toContain(
vm.$el.querySelector('span:nth-child(2)').dataset.originalTitle, 'Locked by testuser',
).toContain('Locked by testuser'); );
}); });
}); });
......
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