From e64d4fd36f0d0b3c5be6e5f666af72ebd58a4293 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Fri, 29 Jun 2018 20:27:15 +0000 Subject: [PATCH] Resolve "Tooltips scroll along the list within Pipeline jobs dropdown on MR widget" --- .../graph/dropdown_job_component.vue | 1 + .../components/graph/job_component.vue | 11 +++++- .../pipelines/components/stage.vue | 37 ++++++++----------- changelogs/unreleased/47516-pipe-scroll.yml | 5 +++ .../pipelines/graph/job_component_spec.js | 30 +++++++++++++++ 5 files changed, 62 insertions(+), 22 deletions(-) create mode 100644 changelogs/unreleased/47516-pipe-scroll.yml diff --git a/app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue b/app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue index e047d10ac93..c32dc83da8e 100644 --- a/app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue +++ b/app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue @@ -109,6 +109,7 @@ export default { :key="i" > diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue index b9231c002fd..56fdb858088 100644 --- a/app/assets/javascripts/pipelines/components/stage.vue +++ b/app/assets/javascripts/pipelines/components/stage.vue @@ -186,32 +186,27 @@ export default { - + diff --git a/changelogs/unreleased/47516-pipe-scroll.yml b/changelogs/unreleased/47516-pipe-scroll.yml new file mode 100644 index 00000000000..3e283f649bd --- /dev/null +++ b/changelogs/unreleased/47516-pipe-scroll.yml @@ -0,0 +1,5 @@ +--- +title: Prevent pipeline job tooltip from scrolling off dropdown container +merge_request: +author: +type: fixed diff --git a/spec/javascripts/pipelines/graph/job_component_spec.js b/spec/javascripts/pipelines/graph/job_component_spec.js index 073dae56c25..9c55a19ebc7 100644 --- a/spec/javascripts/pipelines/graph/job_component_spec.js +++ b/spec/javascripts/pipelines/graph/job_component_spec.js @@ -135,4 +135,34 @@ describe('pipeline graph job component', () => { expect(component.$el.querySelector('.js-job-component-tooltip').getAttribute('data-original-title')).toEqual('test - success'); }); }); + + describe('tooltip placement', () => { + const tooltipBoundary = 'a[data-boundary="viewport"]'; + + it('does not set tooltip boundary by default', () => { + component = mountComponent(JobComponent, { + job: mockJob, + }); + + expect(component.$el.querySelector(tooltipBoundary)).toBeNull(); + }); + + it('sets tooltip boundary to viewport for small dropdowns', () => { + component = mountComponent(JobComponent, { + job: mockJob, + dropdownLength: 1, + }); + + expect(component.$el.querySelector(tooltipBoundary)).not.toBeNull(); + }); + + it('does not set tooltip boundary for large lists', () => { + component = mountComponent(JobComponent, { + job: mockJob, + dropdownLength: 7, + }); + + expect(component.$el.querySelector(tooltipBoundary)).toBeNull(); + }); + }); });