Commit a64ddaa8 authored by David O'Regan's avatar David O'Regan

Merge branch '301143-polish-for-top-nav-redesign' into 'master'

Style polish for top nav redesign

See merge request gitlab-org/gitlab!63241
parents fa78da98 e4580c13
<script> <script>
/* eslint-disable vue/require-default-prop, vue/no-v-html */ /* eslint-disable vue/require-default-prop, vue/no-v-html */
import { GlButton } from '@gitlab/ui';
import highlight from '~/lib/utils/highlight'; import highlight from '~/lib/utils/highlight';
import { truncateNamespace } from '~/lib/utils/text_utility'; import { truncateNamespace } from '~/lib/utils/text_utility';
import { mapVuexModuleState } from '~/lib/utils/vuex_module_mappers'; import { mapVuexModuleState } from '~/lib/utils/vuex_module_mappers';
...@@ -11,6 +12,7 @@ const trackingMixin = Tracking.mixin(); ...@@ -11,6 +12,7 @@ const trackingMixin = Tracking.mixin();
export default { export default {
components: { components: {
Identicon, Identicon,
GlButton,
}, },
mixins: [trackingMixin], mixins: [trackingMixin],
inject: ['vuexModule'], inject: ['vuexModule'],
...@@ -56,9 +58,10 @@ export default { ...@@ -56,9 +58,10 @@ export default {
<template> <template>
<li class="frequent-items-list-item-container"> <li class="frequent-items-list-item-container">
<a <gl-button
category="tertiary"
:href="webUrl" :href="webUrl"
class="clearfix dropdown-item" class="gl-text-left gl-justify-content-start!"
@click="track('click_link', { label: `${dropdownType}_dropdown_frequent_items_list_item` })" @click="track('click_link', { label: `${dropdownType}_dropdown_frequent_items_list_item` })"
> >
<div <div
...@@ -90,6 +93,6 @@ export default { ...@@ -90,6 +93,6 @@ export default {
{{ truncatedNamespace }} {{ truncatedNamespace }}
</div> </div>
</div> </div>
</a> </gl-button>
</li> </li>
</template> </template>
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
v-on="$listeners" v-on="$listeners"
> >
<span class="gl-display-flex"> <span class="gl-display-flex">
<gl-icon v-if="menuItem.icon" :name="menuItem.icon" :class="{ 'gl-mr-2!': !iconOnly }" /> <gl-icon v-if="menuItem.icon" :name="menuItem.icon" :class="{ 'gl-mr-3!': !iconOnly }" />
<template v-if="!iconOnly"> <template v-if="!iconOnly">
{{ menuItem.title }} {{ menuItem.title }}
<gl-icon v-if="menuItem.view" name="chevron-right" class="gl-ml-auto" /> <gl-icon v-if="menuItem.view" name="chevron-right" class="gl-ml-auto" />
......
<script> <script>
import TopNavMenuItem from './top_nav_menu_item.vue'; import TopNavMenuItem from './top_nav_menu_item.vue';
const BORDER_CLASSES = 'gl-pt-3 gl-border-1 gl-border-t-solid gl-border-gray-100'; const BORDER_CLASSES = 'gl-pt-3 gl-border-1 gl-border-t-solid gl-border-gray-50';
export default { export default {
components: { components: {
......
import { GlButton } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
...@@ -18,7 +19,7 @@ describe('FrequentItemsListItemComponent', () => { ...@@ -18,7 +19,7 @@ describe('FrequentItemsListItemComponent', () => {
const findAvatar = () => wrapper.find({ ref: 'frequentItemsItemAvatar' }); const findAvatar = () => wrapper.find({ ref: 'frequentItemsItemAvatar' });
const findAllTitles = () => wrapper.findAll({ ref: 'frequentItemsItemTitle' }); const findAllTitles = () => wrapper.findAll({ ref: 'frequentItemsItemTitle' });
const findNamespace = () => wrapper.find({ ref: 'frequentItemsItemNamespace' }); const findNamespace = () => wrapper.find({ ref: 'frequentItemsItemNamespace' });
const findAllAnchors = () => wrapper.findAll('a'); const findAllButtons = () => wrapper.findAllComponents(GlButton);
const findAllNamespace = () => wrapper.findAll({ ref: 'frequentItemsItemNamespace' }); const findAllNamespace = () => wrapper.findAll({ ref: 'frequentItemsItemNamespace' });
const findAvatarContainer = () => wrapper.findAll({ ref: 'frequentItemsItemAvatarContainer' }); const findAvatarContainer = () => wrapper.findAll({ ref: 'frequentItemsItemAvatarContainer' });
const findAllMetadataContainers = () => const findAllMetadataContainers = () =>
...@@ -109,7 +110,7 @@ describe('FrequentItemsListItemComponent', () => { ...@@ -109,7 +110,7 @@ describe('FrequentItemsListItemComponent', () => {
it.each` it.each`
name | selector | expected name | selector | expected
${'anchor'} | ${findAllAnchors} | ${1} ${'button'} | ${findAllButtons} | ${1}
${'avatar container'} | ${findAvatarContainer} | ${1} ${'avatar container'} | ${findAvatarContainer} | ${1}
${'metadata container'} | ${findAllMetadataContainers} | ${1} ${'metadata container'} | ${findAllMetadataContainers} | ${1}
${'title'} | ${findAllTitles} | ${1} ${'title'} | ${findAllTitles} | ${1}
...@@ -119,13 +120,10 @@ describe('FrequentItemsListItemComponent', () => { ...@@ -119,13 +120,10 @@ describe('FrequentItemsListItemComponent', () => {
}); });
it('tracks when item link is clicked', () => { it('tracks when item link is clicked', () => {
const link = wrapper.find('a'); const link = wrapper.findComponent(GlButton);
// NOTE: this listener is required to prevent the click from going through and causing:
// `Error: Not implemented: navigation ...` link.vm.$emit('click');
link.element.addEventListener('click', (e) => {
e.preventDefault();
});
link.trigger('click');
expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_link', { expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_link', {
label: 'projects_dropdown_frequent_items_list_item', label: 'projects_dropdown_frequent_items_list_item',
}); });
......
...@@ -73,7 +73,7 @@ describe('~/nav/components/top_nav_menu_item.vue', () => { ...@@ -73,7 +73,7 @@ describe('~/nav/components/top_nav_menu_item.vue', () => {
expect(findButtonIcons()).toEqual([ expect(findButtonIcons()).toEqual([
{ {
name: TEST_MENU_ITEM.icon, name: TEST_MENU_ITEM.icon,
classes: ['gl-mr-2!'], classes: ['gl-mr-3!'],
}, },
{ {
name: 'chevron-right', name: 'chevron-right',
......
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