Commit eb8b8485 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch '218485-improve-styling-of-the-button' into 'master'

Update split button styling

See merge request gitlab-org/gitlab!44399
parents 554d2366 72ef6c86
<script> <script>
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlIcon } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
export default { export default {
components: { components: {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon,
}, },
props: { props: {
buttons: { buttons: {
...@@ -36,31 +35,24 @@ export default { ...@@ -36,31 +35,24 @@ export default {
</script> </script>
<template> <template>
<gl-deprecated-dropdown <gl-dropdown
v-if="selectedButton" v-if="selectedButton"
:disabled="disabled" :disabled="disabled"
no-caret
right
split
variant="success" variant="success"
:text="selectedButton.name" :text="selectedButton.name"
split
@click="handleClick" @click="handleClick"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="button in buttons" v-for="button in buttons"
:key="button.action" :key="button.action"
:is-checked="selectedButton === button"
is-check-item
@click="setButton(button)" @click="setButton(button)"
> >
<div class="media">
<div>
<gl-icon v-if="selectedButton === button" class="gl-mr-2" name="mobile-issue-close" />
</div>
<div class="media-body" :class="{ 'prepend-left-20': selectedButton !== button }">
<strong>{{ button.name }}</strong> <strong>{{ button.name }}</strong>
<br /> <br />
<span>{{ button.tagline }}</span> <span>{{ button.tagline }}</span>
</div> </gl-dropdown-item>
</div> </gl-dropdown>
</gl-deprecated-dropdown-item>
</gl-deprecated-dropdown>
</template> </template>
---
title: Use the new dropdown for the split button in vulnerability management
merge_request: 44399
author:
type: other
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlIcon } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import SplitButton from 'ee/vue_shared/security_reports/components/split_button.vue'; import SplitButton from 'ee/vue_shared/security_reports/components/split_button.vue';
const buttons = [ const buttons = [
...@@ -20,8 +20,8 @@ const buttons = [ ...@@ -20,8 +20,8 @@ const buttons = [
describe('Split Button', () => { describe('Split Button', () => {
let wrapper; let wrapper;
const findDropdown = () => wrapper.find(GlDeprecatedDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const findDropdownItems = () => wrapper.findAll(GlDeprecatedDropdownItem); const findDropdownItems = () => wrapper.findAll(GlDropdownItem);
const createComponent = props => { const createComponent = props => {
wrapper = shallowMount(SplitButton, { wrapper = shallowMount(SplitButton, {
...@@ -80,8 +80,7 @@ describe('Split Button', () => { ...@@ -80,8 +80,7 @@ describe('Split Button', () => {
expect( expect(
findDropdownItems() findDropdownItems()
.at(0) .at(0)
.find(GlIcon) .props('isChecked'),
.exists(),
).toBe(true); ).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