summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-12-20 13:25:58 +0000
committerFilipa Lacerda <filipa@gitlab.com>2016-12-20 14:04:19 +0000
commit3ef1e76659d0d583a2fd72d86309c2ba6816a316 (patch)
tree8cd638c6ff2d1adbafd14fbcbb952d7aef2a75cf
parent4b9bd188433d77fbaec8ae445716de8084b6a145 (diff)
downloadgitlab-ce-3ef1e76659d0d583a2fd72d86309c2ba6816a316.tar.gz
Fix broken test
Changes after review
-rw-r--r--app/assets/javascripts/mini_pipeline_graph_dropdown.js.es621
-rw-r--r--app/views/projects/ci/pipelines/_pipeline.html.haml10
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb5
-rw-r--r--spec/models/ci/stage_spec.rb2
4 files changed, 22 insertions, 16 deletions
diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6
index 31b65a22723..90b3366f14b 100644
--- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6
+++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6
@@ -1,3 +1,4 @@
+/* eslint-disable no-new */
/* global Flash */
/**
@@ -30,8 +31,8 @@
bindEvents() {
const dropdownButtonSelector = 'button.js-builds-dropdown-button';
- $(this.container).off('click', dropdownButtonSelector, this.getBuildsList);
- $(this.container).on('click', dropdownButtonSelector, this.getBuildsList);
+ $(this.container).off('click', dropdownButtonSelector, this.getBuildsList)
+ .on('click', dropdownButtonSelector, this.getBuildsList);
}
/**
@@ -55,21 +56,25 @@
* @return {Promise}
*/
getBuildsList(e) {
- const endpoint = e.currentTarget.dataset.stageEndpoint;
+ const button = e.currentTarget;
+ const endpoint = button.dataset.stageEndpoint;
return $.ajax({
dataType: 'json',
type: 'GET',
url: endpoint,
beforeSend: () => {
- this.renderBuildsList(e.currentTarget, '');
- this.toggleLoading(e.currentTarget);
+ this.renderBuildsList(button, '');
+ this.toggleLoading(button);
},
success: (data) => {
- this.toggleLoading(e.currentTarget);
- this.renderBuildsList(e.currentTarget, data.html);
+ this.toggleLoading(button);
+ this.renderBuildsList(button, data.html);
+ },
+ error: () => {
+ this.toggleLoading(button);
+ new Flash('An error occurred while fetching the builds.', 'alert');
},
- error: () => new Flash('An error occurred while fetching the builds.', 'alert'),
});
}
diff --git a/app/views/projects/ci/pipelines/_pipeline.html.haml b/app/views/projects/ci/pipelines/_pipeline.html.haml
index 8541b351e2b..2f8f153f9a9 100644
--- a/app/views/projects/ci/pipelines/_pipeline.html.haml
+++ b/app/views/projects/ci/pipelines/_pipeline.html.haml
@@ -44,17 +44,15 @@
- pipeline.stages.each do |stage|
- if stage.status
- detailed_status = stage.detailed_status(current_user)
- - klass = "has-tooltip ci-status-icon ci-status-icon-#{detailed_status.group}"
- icon_status = "#{detailed_status.icon}_borderless"
- - icon_status_klass = "ci-status-icon ci-status-icon-#{detailed_status.group}"
- - tooltip = "#{stage.name}: #{detailed_status.label || 'not found'}"
+ - status_klass = "ci-status-icon ci-status-icon-#{detailed_status.group}"
.stage-container.mini-pipeline-graph
.dropdown.inline.build-content
- %button.has-tooltip.builds-dropdown.js-builds-dropdown-button{ type: 'button', data: { toggle: 'dropdown', title: tooltip, placement: 'top', "stage-endpoint" => stage_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline, stage: stage.name)}}
- %span{ class: klass }
+ %button.has-tooltip.builds-dropdown.js-builds-dropdown-button{ type: 'button', data: { toggle: 'dropdown', title: "#{stage.name}: #{detailed_status.label}", placement: 'top', "stage-endpoint" => stage_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline, stage: stage.name)}}
+ %span.has-tooltip{ class: status_klass }
%span.mini-pipeline-graph-icon-container
- %span{ class: icon_status_klass }= custom_icon(icon_status)
+ %span{ class: status_klass }= custom_icon(icon_status)
= icon('caret-down', class: 'dropdown-caret')
.js-builds-dropdown-container
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index d1ebb12715f..5a4d14d2f95 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -74,7 +74,10 @@ describe "Pipelines", feature: true, js:true do
before { visit namespace_project_pipelines_path(project.namespace, project) }
- it { expect(page).to have_link('Manual build') }
+ it do
+ find('.js-pipeline-dropdown-manual-actions').click
+ expect(page).to have_link('Manual build')
+ end
context 'when playing' do
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb
index 65a302e9d9b..786091a577d 100644
--- a/spec/models/ci/stage_spec.rb
+++ b/spec/models/ci/stage_spec.rb
@@ -36,7 +36,7 @@ describe Ci::Stage, models: true do
subject { stage.statuses_count }
- it "statuses only from current stage" do
+ it "counts statuses only from current stage" do
is_expected.to eq(1)
end
end