Commit 1876d8dd authored by Paul Slaughter's avatar Paul Slaughter

Update frequent_items to upcoming resp styling

- Add `dropdown-item` so that we're not coupled
  to the `.dropdown-menu li > a` styling
- Added `searchClass` prop to the app component
  so that `d-none d-sm-block` only exists for the
  legacy app.
parent 631c7c83
......@@ -30,6 +30,11 @@ export default {
type: Object,
required: true,
},
searchClass: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapVuexModuleState((vm) => vm.vuexModule, [
......@@ -115,7 +120,11 @@ export default {
<template>
<div class="gl-display-flex gl-flex-direction-column gl-flex-align-items-stretch gl-h-full">
<frequent-items-search-input :namespace="namespace" data-testid="frequent-items-search-input" />
<frequent-items-search-input
:namespace="namespace"
:class="searchClass"
data-testid="frequent-items-search-input"
/>
<gl-loading-icon
v-if="isLoadingItems"
:label="translations.loadingMessage"
......
......@@ -58,7 +58,7 @@ export default {
<li class="frequent-items-list-item-container">
<a
:href="webUrl"
class="clearfix"
class="clearfix dropdown-item"
@click="track('click_link', { label: `${dropdownType}_dropdown_frequent_items_list_item` })"
>
<div
......
......@@ -39,7 +39,7 @@ export default {
</script>
<template>
<div class="search-input-container d-none d-sm-block">
<div class="search-input-container">
<gl-search-box-by-type
v-model="searchQuery"
:placeholder="translations.searchInputPlaceholder"
......
......@@ -60,6 +60,7 @@ export default function initFrequentItemDropdowns() {
namespace,
currentUserName: this.currentUserName,
currentItem: this.currentItem,
searchClass: 'gl-display-none gl-sm-display-block',
},
}),
],
......
......@@ -21,13 +21,14 @@ const TEST_NAMESPACE = 'projects';
const TEST_VUEX_MODULE = 'frequentProjects';
const TEST_PROJECT = currentSession[TEST_NAMESPACE].project;
const TEST_STORAGE_KEY = currentSession[TEST_NAMESPACE].storageKey;
const TEST_SEARCH_CLASS = 'test-search-class';
describe('Frequent Items App Component', () => {
let wrapper;
let mock;
let store;
const createComponent = ({ currentItem = null } = {}) => {
const createComponent = (props = {}) => {
const session = currentSession[TEST_NAMESPACE];
gon.api_version = session.apiVersion;
......@@ -36,7 +37,8 @@ describe('Frequent Items App Component', () => {
propsData: {
namespace: TEST_NAMESPACE,
currentUserName: session.username,
currentItem: currentItem || session.project,
currentItem: session.project,
...props,
},
provide: {
vuexModule: TEST_VUEX_MODULE,
......@@ -88,7 +90,7 @@ describe('Frequent Items App Component', () => {
});
it('should render search input', () => {
expect(findSearchInput().exists()).toBe(true);
expect(findSearchInput().classes()).toEqual(['search-input-container']);
});
it('should render loading animation', async () => {
......@@ -159,6 +161,16 @@ describe('Frequent Items App Component', () => {
});
});
describe('with searchClass', () => {
beforeEach(() => {
createComponent({ searchClass: TEST_SEARCH_CLASS });
});
it('should render search input with searchClass', () => {
expect(findSearchInput().classes()).toEqual(['search-input-container', TEST_SEARCH_CLASS]);
});
});
describe('logging', () => {
it('when created, it should create a project storage entry and adds a project', () => {
createComponent();
......
......@@ -16,8 +16,8 @@ const DEFAULT_PROPS = {
};
const TEST_OTHER_PROPS = {
namespace: 'projects',
currentUserName: '',
currentItem: {},
currentUserName: 'test-user',
currentItem: { id: 'test' },
};
describe('~/nav/components/top_nav_container_view.vue', () => {
......@@ -84,7 +84,7 @@ describe('~/nav/components/top_nav_container_view.vue', () => {
it('renders frequent items app', () => {
expect(findFrequentItemsApp()).toEqual({
vuexModule: DEFAULT_PROPS.frequentItemsVuexModule,
props: TEST_OTHER_PROPS,
props: expect.objectContaining(TEST_OTHER_PROPS),
attributes: expect.objectContaining(EXTRA_ATTRS),
});
});
......
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