Fix broken tests - use the corrent event when button is clicked

This commit is contained in:
Filipa Lacerda 2018-05-03 21:46:35 +01:00
parent eed2812f98
commit a72f4ecbb9
No known key found for this signature in database
GPG key ID: 9CA3FDE4D1E2F1C8
5 changed files with 10 additions and 9 deletions

View file

@ -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"

View file

@ -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();
});

View file

@ -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) {

View file

@ -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 <br> (unknown failure)')
expect(build_element['data-original-title']).to eq('build - failed <br> (unknown failure)')
end
end
end

View file

@ -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');
});
});