Commit ffe164fb authored by Daniel Tian's avatar Daniel Tian

Fix vulnerability save button spinner position

parent 2cd93646
......@@ -135,7 +135,7 @@ export default {
<template>
<history-comment-editor
v-if="isEditingComment"
class="discussion-reply-holder m-3"
class="discussion-reply-holder"
:initial-comment="commentNote"
:is-saving="isSavingComment"
@onSave="saveComment"
......
<script>
import { GlFormTextarea, GlButton, GlLoadingIcon } from '@gitlab/ui';
import { GlFormTextarea, GlButton } from '@gitlab/ui';
export default {
components: { GlFormTextarea, GlButton, GlLoadingIcon },
components: { GlFormTextarea, GlButton },
props: {
initialComment: {
type: String,
......@@ -43,9 +43,9 @@ export default {
ref="saveButton"
variant="success"
:disabled="isSaveButtonDisabled"
:loading="isSaving"
@click="$emit('onSave', trimmedComment)"
>
<gl-loading-icon v-if="isSaving" class="mr-1" />
{{ __('Save comment') }}
</gl-button>
<gl-button ref="cancelButton" class="ml-1" :disabled="isSaving" @click="$emit('onCancel')">
......
---
title: Fix vulnerability save button spinner position
merge_request: 40781
author:
type: fixed
......@@ -51,20 +51,19 @@ describe('History Comment Editor', () => {
expect(wrapper.emitted().onCancel).toHaveLength(1);
});
it('disables the save button when there is no text or only whitespace in the textarea', () => {
it('disables the save button when there is no text or only whitespace in the textarea', async () => {
createWrapper({ initialComment: 'some comment' });
textarea().vm.$emit('input', ' ');
await wrapper.vm.$nextTick();
return wrapper.vm.$nextTick().then(() => {
expect(saveButton().attributes('disabled')).toBeTruthy();
});
expect(saveButton().props('disabled')).toBe(true);
});
it('disables all elements when the isSaving prop is true', () => {
it('disables all elements when the comment is being saved', () => {
createWrapper({ isSaving: true });
expect(textarea().attributes('disabled')).toBeTruthy();
expect(saveButton().attributes('disabled')).toBeTruthy();
expect(cancelButton().attributes('disabled')).toBeTruthy();
expect(saveButton().props('loading')).toBe(true);
expect(cancelButton().props('disabled')).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