Commit 2c4e9593 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch...

Merge branch '219838-replace-gl-deprecated-button-with-gl-button-in-ee-app-assets-javascripts-vue_shared' into 'master'

Replace deprecated buttons in dismiss_button.vue

Closes #229202 and #219838

See merge request gitlab-org/gitlab!38695
parents 13d65ddc ba1ffdd5
<script> <script>
import { GlDeprecatedButton, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
export default { export default {
name: 'DismissButton', name: 'DismissButton',
components: { components: {
GlDeprecatedButton, GlButton,
Icon,
LoadingButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -51,25 +47,28 @@ export default { ...@@ -51,25 +47,28 @@ export default {
<template> <template>
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<loading-button <gl-button
:loading="isDismissing" :loading="isDismissing"
:disabled="isDismissing || disabled" :disabled="isDismissing || disabled"
:label="buttonText" variant="warning"
container-class="js-dismiss-btn btn btn-close" category="secondary"
class="js-dismiss-btn"
@click="handleDismissClick" @click="handleDismissClick"
/> >
<gl-deprecated-button {{ __(buttonText) }}
</gl-button>
<gl-button
v-if="!isDismissed" v-if="!isDismissed"
v-gl-tooltip.hover v-gl-tooltip
v-gl-tooltip.focus
:disabled="disabled" :disabled="disabled"
:title="s__('vulnerability|Add comment & dismiss')" :title="s__('vulnerability|Add comment and dismiss')"
variant="close" variant="warning"
category="secondary"
data-qa-selector="dismiss_with_comment_button" data-qa-selector="dismiss_with_comment_button"
class="js-dismiss-with-comment " class="js-dismiss-with-comment "
:aria-label="s__('vulnerability|Add comment and dismiss')"
icon="comment"
@click="$emit('openDismissalCommentBox')" @click="$emit('openDismissalCommentBox')"
> />
<icon name="comment" />
</gl-deprecated-button>
</div> </div>
</template> </template>
---
title: Replace deprecated button with new button
merge_request: 38695
author:
type: other
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import component from 'ee/vue_shared/security_reports/components/dismiss_button.vue'; import component from 'ee/vue_shared/security_reports/components/dismiss_button.vue';
import LoadingButton from '~/vue_shared/components/loading_button.vue'; import { GlButton } from '@gitlab/ui';
describe('DismissalButton', () => { describe('DismissalButton', () => {
let wrapper; let wrapper;
...@@ -22,7 +22,7 @@ describe('DismissalButton', () => { ...@@ -22,7 +22,7 @@ describe('DismissalButton', () => {
}); });
it('should emit dismiss vulnerabilty when clicked', () => { it('should emit dismiss vulnerabilty when clicked', () => {
wrapper.find(LoadingButton).trigger('click'); wrapper.find(GlButton).trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().dismissVulnerability).toBeTruthy(); expect(wrapper.emitted().dismissVulnerability).toBeTruthy();
}); });
...@@ -53,7 +53,7 @@ describe('DismissalButton', () => { ...@@ -53,7 +53,7 @@ describe('DismissalButton', () => {
}); });
it('should emit revertDismissVulnerabilty when clicked', () => { it('should emit revertDismissVulnerabilty when clicked', () => {
wrapper.find(LoadingButton).trigger('click'); wrapper.find(GlButton).trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().revertDismissVulnerability).toBeTruthy(); expect(wrapper.emitted().revertDismissVulnerability).toBeTruthy();
}); });
......
...@@ -29961,6 +29961,9 @@ msgstr "" ...@@ -29961,6 +29961,9 @@ msgstr ""
msgid "vulnerability|Add comment & dismiss" msgid "vulnerability|Add comment & dismiss"
msgstr "" msgstr ""
msgid "vulnerability|Add comment and dismiss"
msgstr ""
msgid "vulnerability|Dismiss vulnerability" msgid "vulnerability|Dismiss vulnerability"
msgstr "" msgstr ""
......
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