Commit bbcb272e authored by Kevin Comoli's avatar Kevin Comoli Committed by Andrew Fontaine

Revert "Fixing template layout for jest test"

This reverts commit ebda8065ca51a6fe675a011edfe798e617aa038d.
parent e761ced0
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlButton } from '@gitlab/ui';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
import statusIcon from '../mr_widget_status_icon.vue'; import statusIcon from '../mr_widget_status_icon.vue';
...@@ -8,6 +8,7 @@ export default { ...@@ -8,6 +8,7 @@ export default {
components: { components: {
statusIcon, statusIcon,
GlLoadingIcon, GlLoadingIcon,
GlButton,
}, },
props: { props: {
mr: { mr: {
...@@ -33,20 +34,21 @@ export default { ...@@ -33,20 +34,21 @@ export default {
<template> <template>
<div class="mr-widget-body media"> <div class="mr-widget-body media">
<status-icon status="warning" /> <status-icon status="warning" />
<div class="media-body space-children"> <div class="media-body space-children gl-display-flex gl-flex-wrap gl-align-items-center">
<span class="bold"> <span class="bold">
<template v-if="mr.mergeError">{{ mr.mergeError }}</template> <template v-if="mr.mergeError">{{ mr.mergeError }}</template>
{{ s__('mrWidget|This merge request failed to be merged automatically') }} {{ s__('mrWidget|This merge request failed to be merged automatically') }}
</span> </span>
<button <gl-button
:disabled="isRefreshing" :disabled="isRefreshing"
type="button" category="secondary"
class="btn btn-sm btn-default" variant="default"
size="small"
@click="refreshWidget" @click="refreshWidget"
> >
<gl-loading-icon v-if="isRefreshing" :inline="true" /> <gl-loading-icon v-if="isRefreshing" :inline="true" />
{{ s__('mrWidget|Refresh') }} {{ s__('mrWidget|Refresh') }}
</button> </gl-button>
</div> </div>
</div> </div>
</template> </template>
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlButton } from '@gitlab/ui';
import AutoMergeFailedComponent from '~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.vue'; import AutoMergeFailedComponent from '~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.vue';
import eventHub from '~/vue_merge_request_widget/event_hub'; import eventHub from '~/vue_merge_request_widget/event_hub';
describe('MRWidgetAutoMergeFailed', () => { describe('MRWidgetAutoMergeFailed', () => {
let wrapper; let wrapper;
const mergeError = 'This is the merge error'; const mergeError = 'This is the merge error';
const findButton = () => wrapper.find('button'); const findButton = () => wrapper.find(GlButton);
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = shallowMount(AutoMergeFailedComponent, { wrapper = shallowMount(AutoMergeFailedComponent, {
...@@ -38,17 +38,13 @@ describe('MRWidgetAutoMergeFailed', () => { ...@@ -38,17 +38,13 @@ describe('MRWidgetAutoMergeFailed', () => {
it('emits event and shows loading icon when button is clicked', () => { it('emits event and shows loading icon when button is clicked', () => {
jest.spyOn(eventHub, '$emit'); jest.spyOn(eventHub, '$emit');
findButton().trigger('click'); findButton().vm.$emit('click');
expect(eventHub.$emit.mock.calls[0][0]).toBe('MRWidgetUpdateRequested'); expect(eventHub.$emit.mock.calls[0][0]).toBe('MRWidgetUpdateRequested');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(findButton().attributes('disabled')).toEqual('disabled'); expect(findButton().attributes('disabled')).toBe('true');
expect( expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
findButton()
.find(GlLoadingIcon)
.exists(),
).toBe(true);
}); });
}); });
}); });
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