Commit d037a2e9 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix typo

Adds tests
parent 3db1b959
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
type="button" type="button"
@click="onClickAction(action.play_path)" @click="onClickAction(action.play_path)"
class="js-manual-action-link no-btn btn" class="js-manual-action-link no-btn btn"
:class="{ 'disabled': !actions.playable }" :class="{ 'disabled': !action.playable }"
:disabled="!action.playable"> :disabled="!action.playable">
${playIconSvg} ${playIconSvg}
<span> <span>
......
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
data-toggle="dropdown" data-toggle="dropdown"
data-placement="top" data-placement="top"
aria-label="Manual job" aria-label="Manual job"
:disabled="isDisabled"> :disabled="isLoading">
${playIconSvg} ${playIconSvg}
<i class="fa fa-caret-down" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
<i v-if="isLoading" class="fa fa-spinner fa-spin" aria-hidden="true"></i> <i v-if="isLoading" class="fa fa-spinner fa-spin" aria-hidden="true"></i>
...@@ -60,9 +60,9 @@ export default { ...@@ -60,9 +60,9 @@ export default {
<button <button
type="button" type="button"
class="js-pipeline-action-link no-btn btn" class="js-pipeline-action-link no-btn btn"
:class="{ 'disabled': !actions.playable }" :class="{ 'disabled': !action.playable }"
@click="onClickAction(action.path)" @click="onClickAction(action.path)"
:disabled="!actions.playable"> :disabled="!action.playable">
${playIconSvg} ${playIconSvg}
<span>{{action.name}}</span> <span>{{action.name}}</span>
</button> </button>
......
...@@ -192,5 +192,10 @@ FactoryGirl.define do ...@@ -192,5 +192,10 @@ FactoryGirl.define do
trait :no_options do trait :no_options do
options { {} } options { {} }
end end
trait :non_playable do
status 'created'
self.when 'manual'
end
end end
end end
...@@ -32,5 +32,10 @@ FactoryGirl.define do ...@@ -32,5 +32,10 @@ FactoryGirl.define do
environment.update_attribute(:deployments, [deployment]) environment.update_attribute(:deployments, [deployment])
end end
end end
trait :non_playable do
status 'created'
self.when 'manual'
end
end end
end end
...@@ -115,6 +115,21 @@ feature 'Environments page', :feature, :js do ...@@ -115,6 +115,21 @@ feature 'Environments page', :feature, :js do
.not_to change { Ci::Pipeline.count } .not_to change { Ci::Pipeline.count }
end end
scenario 'when action is non playable', js: true do
given(:action) do
create(:ci_build, :manual, :non_playable,
pipeline: pipeline,
name: 'close_app')
end
it 'has disabled button to the manual action' do
find('.js-dropdown-play-icon-container').click
expect(page).to have_button('close_app', disabled: true)
end
end
scenario 'does show build name and id' do scenario 'does show build name and id' do
expect(page).to have_link("#{build.name} ##{build.id}") expect(page).to have_link("#{build.name} ##{build.id}")
end end
......
...@@ -197,6 +197,24 @@ describe 'Pipelines', :feature, :js do ...@@ -197,6 +197,24 @@ describe 'Pipelines', :feature, :js do
end end
end end
context 'with non playable manual action' do
let!(:manual) do
create(:ci_build, :manual, :non_playable,
pipeline: pipeline,
name: 'manual build',
stage: 'test',
commands: 'test')
end
before { visit_project_pipelines }
it 'has disabled button to the manual action' do
find('.js-pipeline-dropdown-manual-actions').click
expect(page).to have_button('manual build', disabled: true)
end
end
context 'for generic statuses' do context 'for generic statuses' do
context 'when running' do context 'when running' do
let!(:running) do let!(:running) 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