summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-06-25 14:13:52 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-06-25 14:13:52 +0000
commit7da7af3a22058a6fb4e22cbf2b659e910cc92d54 (patch)
tree222459d0584d79bae8e212096728d18082864311
parentcab5374b0582db7fc97afb1a78ae0ae2fc41fc9e (diff)
parentbc955da8eabc54302875d100dde2c61ffce84312 (diff)
downloadgitlab-ce-7da7af3a22058a6fb4e22cbf2b659e910cc92d54.tar.gz
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
-rw-r--r--app/assets/javascripts/ide/components/repo_tab.vue2
-rw-r--r--spec/javascripts/ide/components/repo_tab_spec.js26
2 files changed, 25 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/components/repo_tab.vue b/app/assets/javascripts/ide/components/repo_tab.vue
index 1ad52c1bd83..03772ae4a4c 100644
--- a/app/assets/javascripts/ide/components/repo_tab.vue
+++ b/app/assets/javascripts/ide/components/repo_tab.vue
@@ -44,6 +44,8 @@ export default {
methods: {
...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']),
clickFile(tab) {
+ if (tab.active) return;
+
this.updateDelayViewerUpdated(true);
if (tab.pending) {
diff --git a/spec/javascripts/ide/components/repo_tab_spec.js b/spec/javascripts/ide/components/repo_tab_spec.js
index 8cabc6e8935..fc0695a4263 100644
--- a/spec/javascripts/ide/components/repo_tab_spec.js
+++ b/spec/javascripts/ide/components/repo_tab_spec.js
@@ -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',
+ );
});
});