Commit 358ab305 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '229343-update-lock-form-buttons' into 'master'

Update lock form buttons to gl-button

Closes #229343

See merge request gitlab-org/gitlab!41454
parents a53831fd 3ba5c205
<script>
import $ from 'jquery';
import { GlLoadingIcon } from '@gitlab/ui';
import { GlButton } from '@gitlab/ui';
import { mapActions } from 'vuex';
import { __, sprintf } from '../../../locale';
import { deprecatedCreateFlash as Flash } from '~/flash';
......@@ -8,7 +8,7 @@ import eventHub from '../../event_hub';
export default {
components: {
GlLoadingIcon,
GlButton,
},
inject: ['fullPath'],
props: {
......@@ -65,19 +65,19 @@ export default {
<template>
<div class="sidebar-item-warning-message-actions">
<button type="button" class="btn btn-default gl-mr-3" @click="closeForm">
<gl-button class="gl-mr-3" @click="closeForm">
{{ __('Cancel') }}
</button>
</gl-button>
<button
type="button"
<gl-button
data-testid="lock-toggle"
class="btn btn-close"
category="secondary"
variant="warning"
:disabled="isLoading"
:loading="isLoading"
@click.prevent="submitForm"
>
<gl-loading-icon v-if="isLoading" inline />
{{ buttonText }}
</button>
</gl-button>
</div>
</template>
---
title: Update lock form buttons to gl-button
merge_request: 41454
author:
type: changed
import { shallowMount } from '@vue/test-utils';
import { GlLoadingIcon } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import EditFormButtons from '~/sidebar/components/lock/edit_form_buttons.vue';
import eventHub from '~/sidebar/event_hub';
import { deprecatedCreateFlash as flash } from '~/flash';
......@@ -22,7 +21,6 @@ describe('EditFormButtons', () => {
};
const findLockToggle = () => wrapper.find('[data-testid="lock-toggle"]');
const findGlLoadingIcon = () => wrapper.find(GlLoadingIcon);
const createComponent = ({ props = {}, data = {}, resolved = true }) => {
store = issuableType === ISSUABLE_TYPE_ISSUE ? createStore() : createMrStore();
......@@ -33,7 +31,7 @@ describe('EditFormButtons', () => {
jest.spyOn(store, 'dispatch').mockRejectedValue();
}
wrapper = shallowMount(EditFormButtons, {
wrapper = mount(EditFormButtons, {
store,
provide: {
fullPath: '',
......@@ -78,8 +76,8 @@ describe('EditFormButtons', () => {
expect(findLockToggle().attributes('disabled')).toBe('disabled');
});
it('displays the GlLoadingIcon', () => {
expect(findGlLoadingIcon().exists()).toBe(true);
it('sets loading on the toggle button', () => {
expect(findLockToggle().props('loading')).toBe(true);
});
});
......@@ -121,7 +119,7 @@ describe('EditFormButtons', () => {
it('resets loading', async () => {
await wrapper.vm.$nextTick().then(() => {
expect(findGlLoadingIcon().exists()).toBe(false);
expect(findLockToggle().props('loading')).toBe(false);
});
});
......@@ -156,7 +154,7 @@ describe('EditFormButtons', () => {
it('resets loading', async () => {
await wrapper.vm.$nextTick().then(() => {
expect(findGlLoadingIcon().exists()).toBe(false);
expect(findLockToggle().props('loading')).toBe(false);
});
});
......
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