Commit 5694e19c authored by Jeremy Elder's avatar Jeremy Elder Committed by Simon Knox

Replace deprecated buttons with GlButton in …badge_form.vue

parent 82643f14
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
/* eslint-disable vue/no-v-html */ /* eslint-disable vue/no-v-html */
import { escape, debounce } from 'lodash'; import { escape, debounce } from 'lodash';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { GlLoadingIcon, GlFormInput, GlFormGroup } from '@gitlab/ui'; import { GlLoadingIcon, GlFormInput, GlFormGroup, GlButton } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
import createEmptyBadge from '../empty_badge'; import createEmptyBadge from '../empty_badge';
import Badge from './badge.vue'; import Badge from './badge.vue';
...@@ -15,7 +14,7 @@ export default { ...@@ -15,7 +14,7 @@ export default {
name: 'BadgeForm', name: 'BadgeForm',
components: { components: {
Badge, Badge,
LoadingButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
GlFormInput, GlFormInput,
GlFormGroup, GlFormGroup,
...@@ -220,23 +219,23 @@ export default { ...@@ -220,23 +219,23 @@ export default {
</div> </div>
<div v-if="isEditing" class="row-content-block gl-display-flex gl-justify-content-end"> <div v-if="isEditing" class="row-content-block gl-display-flex gl-justify-content-end">
<button class="btn btn-cancel gl-mr-4" type="button" @click="onCancel"> <gl-button class="btn-cancel gl-mr-4" data-testid="cancelEditing" @click="onCancel">
{{ __('Cancel') }} {{ __('Cancel') }}
</button> </gl-button>
<loading-button <gl-button
:loading="isSaving" :loading="isSaving"
:label="s__('Badges|Save changes')"
type="submit" type="submit"
container-class="btn btn-success" variant="success"
/> category="primary"
data-testid="saveEditing"
>
{{ s__('Badges|Save changes') }}
</gl-button>
</div> </div>
<div v-else class="gl-display-flex gl-justify-content-end form-group"> <div v-else class="gl-display-flex gl-justify-content-end form-group">
<loading-button <gl-button :loading="isSaving" type="submit" variant="success" category="primary">
:loading="isSaving" {{ s__('Badges|Add badge') }}
:label="s__('Badges|Add badge')" </gl-button>
type="submit"
container-class="btn btn-success"
/>
</div> </div>
</form> </form>
</template> </template>
---
title: Replacing deprecated buttons and loading buttons with new buttons
merge_request: 40163
author:
type: other
...@@ -82,14 +82,14 @@ describe('BadgeSettings component', () => { ...@@ -82,14 +82,14 @@ describe('BadgeSettings component', () => {
const form = vm.$el.querySelector('form:nth-of-type(1)'); const form = vm.$el.querySelector('form:nth-of-type(1)');
expect(form).not.toBe(null); expect(form).not.toBe(null);
const submitButton = form.querySelector('.btn-success'); const cancelButton = form.querySelector('[data-testid="cancelEditing"]');
expect(submitButton).not.toBe(null);
expect(submitButton).toHaveText(/Save changes/);
const cancelButton = form.querySelector('.btn-cancel');
expect(cancelButton).not.toBe(null); expect(cancelButton).not.toBe(null);
expect(cancelButton).toHaveText(/Cancel/); expect(cancelButton).toHaveText(/Cancel/);
const submitButton = form.querySelector('[data-testid="saveEditing"]');
expect(submitButton).not.toBe(null);
expect(submitButton).toHaveText(/Save changes/);
}); });
it('displays no badge list', () => { it('displays no badge list', () => {
......
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