From a72f4ecbb93857c9c45d84f6c2d70f9cce3b852d Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 3 May 2018 21:46:35 +0100 Subject: Fix broken tests - use the corrent event when button is clicked --- .../javascripts/pipelines/components/graph/action_component.vue | 4 ++-- app/assets/javascripts/pipelines/components/stage.vue | 3 ++- app/assets/javascripts/pipelines/pipeline_details_bundle.js | 4 ++-- spec/features/projects/pipelines/pipelines_spec.rb | 6 +++--- spec/javascripts/pipelines/graph/action_component_spec.js | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/graph/action_component.vue b/app/assets/javascripts/pipelines/components/graph/action_component.vue index 3c3fcc67d91..fd3491c7fe0 100644 --- a/app/assets/javascripts/pipelines/components/graph/action_component.vue +++ b/app/assets/javascripts/pipelines/components/graph/action_component.vue @@ -61,7 +61,7 @@ export default { methods: { onClickAction() { $(this.$el).tooltip('hide'); - eventHub.$emit('graphAction', this.link); + eventHub.$emit('postAction', this.link); this.linkRequested = this.link; this.isDisabled = true; }, @@ -75,7 +75,7 @@ export default { v-tooltip :title="tooltipText" class="js-ci-action btn btn-blank -btn-transparent ci-action-icon-container ci-action-icon-wrapper js-ci-action-icon" +btn-transparent ci-action-icon-container ci-action-icon-wrapper" :class="cssClass" data-container="body" :disabled="isDisabled" diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue index 0b7130517d3..a65485c05eb 100644 --- a/app/assets/javascripts/pipelines/components/stage.vue +++ b/app/assets/javascripts/pipelines/components/stage.vue @@ -117,7 +117,8 @@ export default { */ stopDropdownClickPropagation() { $( - this.$el.querySelectorAll('.js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item'), + '.js-builds-dropdown-list button, .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item', + this.$el, ).on('click', e => { e.stopPropagation(); }); diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index 6584f96130b..04fe7958fe6 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -29,10 +29,10 @@ export default () => { }; }, created() { - eventHub.$on('graphAction', this.postAction); + eventHub.$on('postAction', this.postAction); }, beforeDestroy() { - eventHub.$off('graphAction', this.postAction); + eventHub.$off('postAction', this.postAction); }, methods: { postAction(action) { diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 53e1e4f0251..9faca4023c6 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -388,9 +388,9 @@ describe 'Pipelines', :js do it 'should be possible to cancel pending build' do find('.js-builds-dropdown-button').click - find('.js-ci-action-icon').click + find('.js-ci-action').click + wait_for_requests - expect(page).to have_content('canceled') expect(build.reload).to be_canceled end end @@ -407,7 +407,7 @@ describe 'Pipelines', :js do within('.js-builds-dropdown-list') do build_element = page.find('.mini-pipeline-graph-dropdown-item') - expect(build_element['data-title']).to eq('build - failed
(unknown failure)') + expect(build_element['data-original-title']).to eq('build - failed
(unknown failure)') end end end diff --git a/spec/javascripts/pipelines/graph/action_component_spec.js b/spec/javascripts/pipelines/graph/action_component_spec.js index 3de10392472..d646bef96f5 100644 --- a/spec/javascripts/pipelines/graph/action_component_spec.js +++ b/spec/javascripts/pipelines/graph/action_component_spec.js @@ -22,7 +22,7 @@ describe('pipeline graph action component', () => { }); it('should emit an event with the provided link', () => { - eventHub.$on('graphAction', link => { + eventHub.$on('postAction', link => { expect(link).toEqual('foo'); }); }); -- cgit v1.2.1