Commit ef66fd60 authored by Mark Florian's avatar Mark Florian

Merge branch...

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

Replace deprecated button

See merge request gitlab-org/gitlab!42065
parents 17a184eb 78a51337
<script> <script>
import { GlTooltipDirective, GlDeprecatedButton, GlIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlButton, GlIcon } from '@gitlab/ui';
import NoteHeader from '~/notes/components/note_header.vue'; import NoteHeader from '~/notes/components/note_header.vue';
export default { export default {
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
components: { components: {
GlIcon, GlIcon,
NoteHeader, NoteHeader,
GlDeprecatedButton, GlButton,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -83,17 +83,15 @@ export default { ...@@ -83,17 +83,15 @@ export default {
<slot v-if="showRightSlot" name="right-content"></slot> <slot v-if="showRightSlot" name="right-content"></slot>
<div v-else-if="showActionButtons" class="gl-flex-shrink-0 gl-align-self-start"> <div v-else-if="showActionButtons" class="gl-flex-shrink-0 gl-align-self-start">
<gl-deprecated-button <gl-button
v-for="button in actionButtons" v-for="button in actionButtons"
:key="button.title" :key="button.title"
v-gl-tooltip v-gl-tooltip
class="px-1" category="tertiary"
variant="transparent" :icon="button.iconName"
:title="button.title" :title="button.title"
@click="button.onClick" @click="button.onClick"
> />
<gl-icon :name="button.iconName" class="link-highlight" />
</gl-deprecated-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -79,36 +79,40 @@ exports[`Event Item with action buttons renders the action buttons 1`] = ` ...@@ -79,36 +79,40 @@ exports[`Event Item with action buttons renders the action buttons 1`] = `
class="gl-flex-shrink-0 gl-align-self-start" class="gl-flex-shrink-0 gl-align-self-start"
> >
<button <button
class="btn px-1 btn-transparent btn-md" class="btn btn-default btn-md gl-button btn-default-tertiary btn-icon"
title="Foo Action" title="Foo Action"
type="button" type="button"
> >
<!----> <!---->
<svg <svg
class="link-highlight gl-icon s16" class="gl-button-icon gl-icon s16"
data-testid="pencil-icon" data-testid="pencil-icon"
> >
<use <use
href="#pencil" href="#pencil"
/> />
</svg> </svg>
<!---->
</button> </button>
<button <button
class="btn px-1 btn-transparent btn-md" class="btn btn-default btn-md gl-button btn-default-tertiary btn-icon"
title="Bar Action" title="Bar Action"
type="button" type="button"
> >
<!----> <!---->
<svg <svg
class="link-highlight gl-icon s16" class="gl-button-icon gl-icon s16"
data-testid="remove-icon" data-testid="remove-icon"
> >
<use <use
href="#remove" href="#remove"
/> />
</svg> </svg>
<!---->
</button> </button>
</div> </div>
</div> </div>
......
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import Component from 'ee/vue_shared/security_reports/components/event_item.vue'; import Component from 'ee/vue_shared/security_reports/components/event_item.vue';
import { shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import NoteHeader from '~/notes/components/note_header.vue'; import NoteHeader from '~/notes/components/note_header.vue';
...@@ -91,12 +91,12 @@ describe('Event Item', () => { ...@@ -91,12 +91,12 @@ describe('Event Item', () => {
}); });
it('renders the action buttons', () => { it('renders the action buttons', () => {
expect(wrapper.findAll(GlDeprecatedButton)).toHaveLength(2); expect(wrapper.findAll(GlButton)).toHaveLength(2);
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('emits the button events when clicked', () => { it('emits the button events when clicked', () => {
const buttons = wrapper.findAll(GlDeprecatedButton); const buttons = wrapper.findAll(GlButton);
buttons.at(0).trigger('click'); buttons.at(0).trigger('click');
return wrapper.vm return wrapper.vm
.$nextTick() .$nextTick()
......
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