Commit ca726db0 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Jacques Erasmus

Project search should differentiate between projects with the same name

parent a6b5e4cf
...@@ -201,7 +201,10 @@ export default { ...@@ -201,7 +201,10 @@ export default {
:src="project.avatarUrl" :src="project.avatarUrl"
shape="rect" shape="rect"
/> />
{{ project.name }} <div>
<div data-testid="project-name">{{ project.name }}</div>
<div class="gl-text-gray-500" data-testid="project-full-path">{{ project.fullPath }}</div>
</div>
</div> </div>
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-item v-show="noResultsAvailable" class="gl-pointer-events-none text-secondary">{{ <gl-dropdown-item v-show="noResultsAvailable" class="gl-pointer-events-none text-secondary">{{
......
---
title: Add project full path to analytics project dropdown filter
merge_request: 45020
author:
type: changed
...@@ -69,6 +69,11 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -69,6 +69,11 @@ describe('ProjectsDropdownFilter component', () => {
const findDropdownButtonIdentIconAtIndex = index => const findDropdownButtonIdentIconAtIndex = index =>
findDropdownAtIndex(index).find('div.gl-avatar-identicon'); findDropdownAtIndex(index).find('div.gl-avatar-identicon');
const findDropdownNameAtIndex = index =>
findDropdownAtIndex(index).find('[data-testid="project-name"');
const findDropdownFullPathAtIndex = index =>
findDropdownAtIndex(index).find('[data-testid="project-full-path"]');
const selectDropdownItemAtIndex = index => const selectDropdownItemAtIndex = index =>
findDropdownAtIndex(index) findDropdownAtIndex(index)
.find('button') .find('button')
...@@ -137,10 +142,23 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -137,10 +142,23 @@ describe('ProjectsDropdownFilter component', () => {
expect(findDropdownButtonAvatarAtIndex(0).exists()).toBe(true); expect(findDropdownButtonAvatarAtIndex(0).exists()).toBe(true);
expect(findDropdownButtonIdentIconAtIndex(0).exists()).toBe(false); expect(findDropdownButtonIdentIconAtIndex(0).exists()).toBe(false);
}); });
it("renders an identicon when the project doesn't have an avatarUrl", () => { it("renders an identicon when the project doesn't have an avatarUrl", () => {
expect(findDropdownButtonAvatarAtIndex(1).exists()).toBe(false); expect(findDropdownButtonAvatarAtIndex(1).exists()).toBe(false);
expect(findDropdownButtonIdentIconAtIndex(1).exists()).toBe(true); expect(findDropdownButtonIdentIconAtIndex(1).exists()).toBe(true);
}); });
it('renders the project name', () => {
projects.forEach((project, index) => {
expect(findDropdownNameAtIndex(index).text()).toBe(project.name);
});
});
it('renders the project fullPath', () => {
projects.forEach((project, index) => {
expect(findDropdownFullPathAtIndex(index).text()).toBe(project.fullPath);
});
});
}); });
describe('on project click', () => { describe('on project click', () => {
...@@ -202,6 +220,18 @@ describe('ProjectsDropdownFilter component', () => { ...@@ -202,6 +220,18 @@ describe('ProjectsDropdownFilter component', () => {
expect(findDropdownButtonAvatarAtIndex(1).exists()).toBe(false); expect(findDropdownButtonAvatarAtIndex(1).exists()).toBe(false);
expect(findDropdownButtonIdentIconAtIndex(1).exists()).toBe(true); expect(findDropdownButtonIdentIconAtIndex(1).exists()).toBe(true);
}); });
it('renders the project name', () => {
projects.forEach((project, index) => {
expect(findDropdownNameAtIndex(index).text()).toBe(project.name);
});
});
it('renders the project fullPath', () => {
projects.forEach((project, index) => {
expect(findDropdownFullPathAtIndex(index).text()).toBe(project.fullPath);
});
});
}); });
describe('on project click', () => { describe('on project click', () => {
......
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