Commit b9bdb109 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'migrate-deprecated-avatar-in-ide-project-header' into 'master'

Remove deprecated_project_avatar in web ide

See merge request gitlab-org/gitlab!65747
parents 0e185a22 f9c0135d
<script> <script>
import ProjectAvatarDefault from '~/vue_shared/components/deprecated_project_avatar/default.vue'; import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
export default { export default {
components: { components: {
ProjectAvatarDefault, ProjectAvatar,
}, },
props: { props: {
project: { project: {
...@@ -16,8 +16,12 @@ export default { ...@@ -16,8 +16,12 @@ export default {
<template> <template>
<div class="context-header ide-context-header"> <div class="context-header ide-context-header">
<a :href="project.web_url" :title="s__('IDE|Go to project')"> <a :href="project.web_url" :title="s__('IDE|Go to project')" data-testid="go-to-project-link">
<project-avatar-default :project="project" :size="48" /> <project-avatar
:project-name="project.name"
:project-avatar-url="project.avatar_url"
:size="48"
/>
<span class="ide-sidebar-project-title"> <span class="ide-sidebar-project-title">
<span class="sidebar-context-title"> {{ project.name }} </span> <span class="sidebar-context-title"> {{ project.name }} </span>
<span <span
......
import { shallowMount } from '@vue/test-utils';
import IDEProjectHeader from '~/ide/components/ide_project_header.vue';
import ProjectAvatar from '~/vue_shared/components/project_avatar.vue';
const mockProject = {
name: 'test proj',
avatar_url: 'https://gitlab.com',
path_with_namespace: 'path/with-namespace',
web_url: 'https://gitlab.com/project',
};
describe('IDE project header', () => {
let wrapper;
const findProjectAvatar = () => wrapper.findComponent(ProjectAvatar);
const findProjectLink = () => wrapper.find('[data-testid="go-to-project-link"');
const createComponent = () => {
wrapper = shallowMount(IDEProjectHeader, { propsData: { project: mockProject } });
};
afterEach(() => {
wrapper.destroy();
});
describe('template', () => {
beforeEach(() => {
createComponent();
});
it('renders ProjectAvatar with correct props', () => {
expect(findProjectAvatar().props()).toMatchObject({
projectName: mockProject.name,
projectAvatarUrl: mockProject.avatar_url,
});
});
it('renders a link to the project URL', () => {
const link = findProjectLink();
expect(link.exists()).toBe(true);
expect(link.attributes('href')).toBe(mockProject.web_url);
});
});
});
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