Commit 3ef1e766 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix broken test

Changes after review
parent 4b9bd188
/* eslint-disable no-new */
/* global Flash */ /* global Flash */
/** /**
...@@ -30,8 +31,8 @@ ...@@ -30,8 +31,8 @@
bindEvents() { bindEvents() {
const dropdownButtonSelector = 'button.js-builds-dropdown-button'; const dropdownButtonSelector = 'button.js-builds-dropdown-button';
$(this.container).off('click', dropdownButtonSelector, this.getBuildsList); $(this.container).off('click', dropdownButtonSelector, this.getBuildsList)
$(this.container).on('click', dropdownButtonSelector, this.getBuildsList); .on('click', dropdownButtonSelector, this.getBuildsList);
} }
/** /**
...@@ -55,21 +56,25 @@ ...@@ -55,21 +56,25 @@
* @return {Promise} * @return {Promise}
*/ */
getBuildsList(e) { getBuildsList(e) {
const endpoint = e.currentTarget.dataset.stageEndpoint; const button = e.currentTarget;
const endpoint = button.dataset.stageEndpoint;
return $.ajax({ return $.ajax({
dataType: 'json', dataType: 'json',
type: 'GET', type: 'GET',
url: endpoint, url: endpoint,
beforeSend: () => { beforeSend: () => {
this.renderBuildsList(e.currentTarget, ''); this.renderBuildsList(button, '');
this.toggleLoading(e.currentTarget); this.toggleLoading(button);
}, },
success: (data) => { success: (data) => {
this.toggleLoading(e.currentTarget); this.toggleLoading(button);
this.renderBuildsList(e.currentTarget, data.html); 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'),
}); });
} }
......
...@@ -44,17 +44,15 @@ ...@@ -44,17 +44,15 @@
- pipeline.stages.each do |stage| - pipeline.stages.each do |stage|
- if stage.status - if stage.status
- detailed_status = stage.detailed_status(current_user) - 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 = "#{detailed_status.icon}_borderless"
- icon_status_klass = "ci-status-icon ci-status-icon-#{detailed_status.group}" - status_klass = "ci-status-icon ci-status-icon-#{detailed_status.group}"
- tooltip = "#{stage.name}: #{detailed_status.label || 'not found'}"
.stage-container.mini-pipeline-graph .stage-container.mini-pipeline-graph
.dropdown.inline.build-content .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)}} %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{ class: klass } %span.has-tooltip{ class: status_klass }
%span.mini-pipeline-graph-icon-container %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') = icon('caret-down', class: 'dropdown-caret')
.js-builds-dropdown-container .js-builds-dropdown-container
......
...@@ -74,7 +74,10 @@ describe "Pipelines", feature: true, js:true do ...@@ -74,7 +74,10 @@ describe "Pipelines", feature: true, js:true do
before { visit namespace_project_pipelines_path(project.namespace, project) } 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 context 'when playing' do
......
...@@ -36,7 +36,7 @@ describe Ci::Stage, models: true do ...@@ -36,7 +36,7 @@ describe Ci::Stage, models: true do
subject { stage.statuses_count } subject { stage.statuses_count }
it "statuses only from current stage" do it "counts statuses only from current stage" do
is_expected.to eq(1) is_expected.to eq(1)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment