Commit cf8f4c57 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '229213-replace-loading-button-error-tracking-form' into 'master'

Replace loading button with GlButton in Error Tracking form

Closes #229213

See merge request gitlab-org/gitlab!42077
parents b669b9d6 c53dc88d
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { GlFormInput, GlIcon } from '@gitlab/ui'; import { GlFormInput, GlIcon, GlButton } from '@gitlab/ui';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
export default { export default {
components: { GlFormInput, GlIcon, LoadingButton }, components: { GlFormInput, GlIcon, GlButton },
computed: { computed: {
...mapState(['apiHost', 'connectError', 'connectSuccessful', 'isLoadingProjects', 'token']), ...mapState(['apiHost', 'connectError', 'connectSuccessful', 'isLoadingProjects', 'token']),
tokenInputState() { tokenInputState() {
...@@ -57,12 +56,16 @@ export default { ...@@ -57,12 +56,16 @@ export default {
/> />
</div> </div>
<div class="col-4 col-md-3 gl-pl-0"> <div class="col-4 col-md-3 gl-pl-0">
<loading-button <gl-button
class="js-error-tracking-connect gl-ml-2 d-inline-flex" class="js-error-tracking-connect gl-ml-2 d-inline-flex"
:label="isLoadingProjects ? __('Connecting') : __('Connect')" category="secondary"
variant="default"
:loading="isLoadingProjects" :loading="isLoadingProjects"
@click="fetchProjects" @click="fetchProjects"
/> >
{{ isLoadingProjects ? __('Connecting') : __('Connect') }}
</gl-button>
<gl-icon <gl-icon
v-show="connectSuccessful" v-show="connectSuccessful"
class="js-error-tracking-connect-success gl-ml-2 text-success align-middle" class="js-error-tracking-connect-success gl-ml-2 text-success align-middle"
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlFormInput } from '@gitlab/ui'; import { GlFormInput, GlButton } from '@gitlab/ui';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracking_form.vue'; import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracking_form.vue';
import createStore from '~/error_tracking_settings/store'; import createStore from '~/error_tracking_settings/store';
import { defaultProps } from '../mock'; import { defaultProps } from '../mock';
...@@ -43,7 +42,7 @@ describe('error tracking settings form', () => { ...@@ -43,7 +42,7 @@ describe('error tracking settings form', () => {
.attributes('id'), .attributes('id'),
).toBe('error-tracking-token'); ).toBe('error-tracking-token');
expect(wrapper.findAll(LoadingButton).exists()).toBe(true); expect(wrapper.findAll(GlButton).exists()).toBe(true);
}); });
it('is rendered with labels and placeholders', () => { it('is rendered with labels and placeholders', () => {
...@@ -72,9 +71,10 @@ describe('error tracking settings form', () => { ...@@ -72,9 +71,10 @@ describe('error tracking settings form', () => {
}); });
it('shows loading spinner', () => { it('shows loading spinner', () => {
const { label, loading } = wrapper.find(LoadingButton).props(); const buttonEl = wrapper.find(GlButton);
expect(loading).toBe(true);
expect(label).toBe('Connecting'); expect(buttonEl.props('loading')).toBe(true);
expect(buttonEl.text()).toBe('Connecting');
}); });
}); });
......
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