Commit ce75de08 authored by Tim Zallmann's avatar Tim Zallmann

Fixes for Tests

parent 4731eba4
<script> <script>
import tooltip from '../../../vue_shared/directives/tooltip'; import tooltip from '../../../vue_shared/directives/tooltip';
import icon from '../../../vue_shared/components/icon.vue'; import icon from '../../../vue_shared/components/icon.vue';
/** /**
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
computed: { computed: {
cssClass() { cssClass() {
return `${gl.text.dasherize(this.actionIcon)} js-${gl.text.dasherize(this.actionIcon)}`; return `${gl.text.dasherize(this.actionIcon)} js-icon-${gl.text.dasherize(this.actionIcon)}`;
}, },
}, },
}; };
......
<script> <script>
import getActionIcon from '../../../vue_shared/ci_action_icons';
import icon from '../../../vue_shared/components/icon.vue'; import icon from '../../../vue_shared/components/icon.vue';
import tooltip from '../../../vue_shared/directives/tooltip'; import tooltip from '../../../vue_shared/directives/tooltip';
......
import cancelSVG from 'icons/_icon_action_cancel.svg';
import retrySVG from 'icons/_icon_action_retry.svg';
import playSVG from 'icons/_icon_action_play.svg';
import stopSVG from 'icons/_icon_action_stop.svg';
/**
* For the provided action returns the respective SVG
*
* @param {String} action
* @return {SVG|String}
*/
export default function getActionIcon(action) {
const icons = {
icon_action_cancel: cancelSVG,
icon_action_play: playSVG,
icon_action_retry: retrySVG,
icon_action_stop: stopSVG,
};
return icons[action] || '';
}
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
computed: { computed: {
spriteHref() { spriteHref() {
return `${gon.sprite_icons}#${this.name}` return `${gon.sprite_icons}#${this.name}`;
}, },
fullCssClass() { fullCssClass() {
let classString = '' || this.cssClass; let classString = '' || this.cssClass;
if (this.size) classString += `s${this.size}` if (this.size) classString += `s${this.size}`;
return classString; return classString;
}, },
}, },
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<template> <template>
<svg <svg
:class="fullCssClass"> :class="fullCssClass">
<use v-bind="{'xlink:href':spriteHref}"/> <use
v-bind="{'xlink:href':spriteHref}"/>
</svg> </svg>
</template> </template>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.stage-container.dropdown{ class: klass } .stage-container.dropdown{ class: klass }
%button.mini-pipeline-graph-dropdown-toggle.has-tooltip.js-builds-dropdown-button{ class: "ci-status-icon-#{detailed_status.group}", type: 'button', data: { toggle: 'dropdown', title: "#{stage.name}: #{detailed_status.label}", placement: 'top', "stage-endpoint" => stage_project_pipeline_path(pipeline.project, pipeline, stage: stage.name) } } %button.mini-pipeline-graph-dropdown-toggle.has-tooltip.js-builds-dropdown-button{ class: "ci-status-icon-#{detailed_status.group}", type: 'button', data: { toggle: 'dropdown', title: "#{stage.name}: #{detailed_status.label}", placement: 'top', "stage-endpoint" => stage_project_pipeline_path(pipeline.project, pipeline, stage: stage.name) } }
= custom_icon(icon_status) = sprite_icon(icon_status)
= icon('caret-down') = icon('caret-down')
%ul.dropdown-menu.mini-pipeline-graph-dropdown-menu.js-builds-dropdown-container %ul.dropdown-menu.mini-pipeline-graph-dropdown-menu.js-builds-dropdown-container
......
...@@ -67,7 +67,7 @@ describe 'Pipeline', :js do ...@@ -67,7 +67,7 @@ describe 'Pipeline', :js do
it 'shows a running icon and a cancel action for the running build' do it 'shows a running icon and a cancel action for the running build' do
page.within('#ci-badge-deploy') do page.within('#ci-badge-deploy') do
expect(page).to have_selector('.js-ci-status-icon-running') expect(page).to have_selector('.js-ci-status-icon-running')
expect(page).to have_selector('.js-icon-action-cancel') expect(page).to have_selector('.js-icon-cancel')
expect(page).to have_content('deploy') expect(page).to have_content('deploy')
end end
end end
...@@ -87,7 +87,7 @@ describe 'Pipeline', :js do ...@@ -87,7 +87,7 @@ describe 'Pipeline', :js do
end end
page.within('#ci-badge-build .ci-action-icon-container') do page.within('#ci-badge-build .ci-action-icon-container') do
expect(page).to have_selector('.js-icon-action-retry') expect(page).to have_selector('.js-icon-retry')
end end
end end
...@@ -106,7 +106,7 @@ describe 'Pipeline', :js do ...@@ -106,7 +106,7 @@ describe 'Pipeline', :js do
end end
page.within('#ci-badge-test .ci-action-icon-container') do page.within('#ci-badge-test .ci-action-icon-container') do
expect(page).to have_selector('.js-icon-action-retry') expect(page).to have_selector('.js-icon-retry')
end end
end end
...@@ -125,7 +125,7 @@ describe 'Pipeline', :js do ...@@ -125,7 +125,7 @@ describe 'Pipeline', :js do
end end
page.within('#ci-badge-manual-build .ci-action-icon-container') do page.within('#ci-badge-manual-build .ci-action-icon-container') do
expect(page).to have_selector('.js-icon-action-play') expect(page).to have_selector('.js-icon-play')
end end
end end
......
...@@ -11,63 +11,63 @@ describe('CI Badge Link Component', () => { ...@@ -11,63 +11,63 @@ describe('CI Badge Link Component', () => {
text: 'canceled', text: 'canceled',
label: 'canceled', label: 'canceled',
group: 'canceled', group: 'canceled',
icon: 'icon_status_canceled', icon: 'status_canceled',
details_path: 'status/canceled', details_path: 'status/canceled',
}, },
created: { created: {
text: 'created', text: 'created',
label: 'created', label: 'created',
group: 'created', group: 'created',
icon: 'icon_status_created', icon: 'status_created',
details_path: 'status/created', details_path: 'status/created',
}, },
failed: { failed: {
text: 'failed', text: 'failed',
label: 'failed', label: 'failed',
group: 'failed', group: 'failed',
icon: 'icon_status_failed', icon: 'status_failed',
details_path: 'status/failed', details_path: 'status/failed',
}, },
manual: { manual: {
text: 'manual', text: 'manual',
label: 'manual action', label: 'manual action',
group: 'manual', group: 'manual',
icon: 'icon_status_manual', icon: 'status_manual',
details_path: 'status/manual', details_path: 'status/manual',
}, },
pending: { pending: {
text: 'pending', text: 'pending',
label: 'pending', label: 'pending',
group: 'pending', group: 'pending',
icon: 'icon_status_pending', icon: 'status_pending',
details_path: 'status/pending', details_path: 'status/pending',
}, },
running: { running: {
text: 'running', text: 'running',
label: 'running', label: 'running',
group: 'running', group: 'running',
icon: 'icon_status_running', icon: 'status_running',
details_path: 'status/running', details_path: 'status/running',
}, },
skipped: { skipped: {
text: 'skipped', text: 'skipped',
label: 'skipped', label: 'skipped',
group: 'skipped', group: 'skipped',
icon: 'icon_status_skipped', icon: 'status_skipped',
details_path: 'status/skipped', details_path: 'status/skipped',
}, },
success_warining: { success_warining: {
text: 'passed', text: 'passed',
label: 'passed', label: 'passed',
group: 'success_with_warnings', group: 'success_with_warnings',
icon: 'icon_status_warning', icon: 'status_warning',
details_path: 'status/warning', details_path: 'status/warning',
}, },
success: { success: {
text: 'passed', text: 'passed',
label: 'passed', label: 'passed',
group: 'passed', group: 'passed',
icon: 'icon_status_success', icon: 'status_success',
details_path: 'status/passed', details_path: 'status/passed',
}, },
}; };
......
...@@ -66,7 +66,7 @@ describe Gitlab::Ci::Status::Build::Cancelable do ...@@ -66,7 +66,7 @@ describe Gitlab::Ci::Status::Build::Cancelable do
end end
describe '#action_icon' do describe '#action_icon' do
it { expect(subject.action_icon).to eq 'icon_action_cancel' } it { expect(subject.action_icon).to eq 'cancel' }
end end
describe '#action_title' do describe '#action_title' do
......
...@@ -30,7 +30,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -30,7 +30,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'passed' expect(status.text).to eq 'passed'
expect(status.icon).to eq 'icon_status_success' expect(status.icon).to eq 'status_success'
expect(status.favicon).to eq 'favicon_status_success' expect(status.favicon).to eq 'favicon_status_success'
expect(status.label).to eq 'passed' expect(status.label).to eq 'passed'
expect(status).to have_details expect(status).to have_details
...@@ -57,7 +57,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -57,7 +57,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'failed' expect(status.text).to eq 'failed'
expect(status.icon).to eq 'icon_status_failed' expect(status.icon).to eq 'status_failed'
expect(status.favicon).to eq 'favicon_status_failed' expect(status.favicon).to eq 'favicon_status_failed'
expect(status.label).to eq 'failed' expect(status.label).to eq 'failed'
expect(status).to have_details expect(status).to have_details
...@@ -84,7 +84,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -84,7 +84,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'failed' expect(status.text).to eq 'failed'
expect(status.icon).to eq 'icon_status_warning' expect(status.icon).to eq 'status_warning'
expect(status.favicon).to eq 'favicon_status_failed' expect(status.favicon).to eq 'favicon_status_failed'
expect(status.label).to eq 'failed (allowed to fail)' expect(status.label).to eq 'failed (allowed to fail)'
expect(status).to have_details expect(status).to have_details
...@@ -113,7 +113,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -113,7 +113,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'canceled' expect(status.text).to eq 'canceled'
expect(status.icon).to eq 'icon_status_canceled' expect(status.icon).to eq 'status_canceled'
expect(status.favicon).to eq 'favicon_status_canceled' expect(status.favicon).to eq 'favicon_status_canceled'
expect(status.label).to eq 'canceled' expect(status.label).to eq 'canceled'
expect(status).to have_details expect(status).to have_details
...@@ -139,7 +139,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -139,7 +139,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'running' expect(status.text).to eq 'running'
expect(status.icon).to eq 'icon_status_running' expect(status.icon).to eq 'status_running'
expect(status.favicon).to eq 'favicon_status_running' expect(status.favicon).to eq 'favicon_status_running'
expect(status.label).to eq 'running' expect(status.label).to eq 'running'
expect(status).to have_details expect(status).to have_details
...@@ -165,7 +165,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -165,7 +165,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'pending' expect(status.text).to eq 'pending'
expect(status.icon).to eq 'icon_status_pending' expect(status.icon).to eq 'status_pending'
expect(status.favicon).to eq 'favicon_status_pending' expect(status.favicon).to eq 'favicon_status_pending'
expect(status.label).to eq 'pending' expect(status.label).to eq 'pending'
expect(status).to have_details expect(status).to have_details
...@@ -190,7 +190,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -190,7 +190,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'skipped' expect(status.text).to eq 'skipped'
expect(status.icon).to eq 'icon_status_skipped' expect(status.icon).to eq status_skipped'
expect(status.favicon).to eq 'favicon_status_skipped' expect(status.favicon).to eq 'favicon_status_skipped'
expect(status.label).to eq 'skipped' expect(status.label).to eq 'skipped'
expect(status).to have_details expect(status).to have_details
...@@ -219,7 +219,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -219,7 +219,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'manual' expect(status.text).to eq 'manual'
expect(status.group).to eq 'manual' expect(status.group).to eq 'manual'
expect(status.icon).to eq 'icon_status_manual' expect(status.icon).to eq 'status_manual'
expect(status.favicon).to eq 'favicon_status_manual' expect(status.favicon).to eq 'favicon_status_manual'
expect(status.label).to include 'manual play action' expect(status.label).to include 'manual play action'
expect(status).to have_details expect(status).to have_details
...@@ -274,7 +274,7 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -274,7 +274,7 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'manual' expect(status.text).to eq 'manual'
expect(status.group).to eq 'manual' expect(status.group).to eq 'manual'
expect(status.icon).to eq 'icon_status_manual' expect(status.icon).to eq 'status_manual'
expect(status.favicon).to eq 'favicon_status_manual' expect(status.favicon).to eq 'favicon_status_manual'
expect(status.label).to eq 'manual stop action (not allowed)' expect(status.label).to eq 'manual stop action (not allowed)'
expect(status).to have_details expect(status).to have_details
......
...@@ -18,7 +18,7 @@ describe Gitlab::Ci::Status::Build::FailedAllowed do ...@@ -18,7 +18,7 @@ describe Gitlab::Ci::Status::Build::FailedAllowed do
describe '#icon' do describe '#icon' do
it 'returns a warning icon' do it 'returns a warning icon' do
expect(subject.icon).to eq 'icon_status_warning' expect(subject.icon).to eq 'status_warning'
end end
end end
......
...@@ -46,7 +46,7 @@ describe Gitlab::Ci::Status::Build::Play do ...@@ -46,7 +46,7 @@ describe Gitlab::Ci::Status::Build::Play do
end end
describe '#action_icon' do describe '#action_icon' do
it { expect(subject.action_icon).to eq 'icon_action_play' } it { expect(subject.action_icon).to eq 'play' }
end end
describe '#action_title' do describe '#action_title' do
......
...@@ -66,7 +66,7 @@ describe Gitlab::Ci::Status::Build::Retryable do ...@@ -66,7 +66,7 @@ describe Gitlab::Ci::Status::Build::Retryable do
end end
describe '#action_icon' do describe '#action_icon' do
it { expect(subject.action_icon).to eq 'icon_action_retry' } it { expect(subject.action_icon).to eq 'retry' }
end end
describe '#action_title' do describe '#action_title' do
......
...@@ -38,7 +38,7 @@ describe Gitlab::Ci::Status::Build::Stop do ...@@ -38,7 +38,7 @@ describe Gitlab::Ci::Status::Build::Stop do
end end
describe '#action_icon' do describe '#action_icon' do
it { expect(subject.action_icon).to eq 'icon_action_stop' } it { expect(subject.action_icon).to eq 'stop' }
end end
describe '#action_title' do describe '#action_title' do
......
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