Fixed the IDE commit list item loosing its active state

Closes #48125
This commit is contained in:
Phil Hughes 2018-06-25 11:58:24 +01:00
parent 9490c37833
commit bc955da8ea
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F
2 changed files with 25 additions and 3 deletions

View file

@ -44,6 +44,8 @@ export default {
methods: {
...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']),
clickFile(tab) {
if (tab.active) return;
this.updateDelayViewerUpdated(true);
if (tab.pending) {

View file

@ -38,6 +38,26 @@ describe('RepoTab', () => {
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', () => {
vm = createComponent({
tab: file(),
@ -112,9 +132,9 @@ describe('RepoTab', () => {
});
it('renders a tooltip', () => {
expect(
vm.$el.querySelector('span:nth-child(2)').dataset.originalTitle,
).toContain('Locked by testuser');
expect(vm.$el.querySelector('span:nth-child(2)').dataset.originalTitle).toContain(
'Locked by testuser',
);
});
});