parent
aa2a97b545
commit
6202657ec7
3 changed files with 62 additions and 7 deletions
|
@ -1,13 +1,15 @@
|
|||
<script>
|
||||
import projectAvatarImage from '~/vue_shared/components/project_avatar/image.vue';
|
||||
import branchesTree from './ide_project_branches_tree.vue';
|
||||
import externalLinks from './ide_external_links.vue';
|
||||
import ProjectAvatarImage from '~/vue_shared/components/project_avatar/image.vue';
|
||||
import Identicon from '../../vue_shared/components/identicon.vue';
|
||||
import BranchesTree from './ide_project_branches_tree.vue';
|
||||
import ExternalLinks from './ide_external_links.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
branchesTree,
|
||||
externalLinks,
|
||||
projectAvatarImage,
|
||||
BranchesTree,
|
||||
ExternalLinks,
|
||||
ProjectAvatarImage,
|
||||
Identicon,
|
||||
},
|
||||
props: {
|
||||
project: {
|
||||
|
@ -25,7 +27,10 @@ export default {
|
|||
:title="project.name"
|
||||
:href="project.web_url"
|
||||
>
|
||||
<div class="avatar-container s40 project-avatar">
|
||||
<div
|
||||
v-if="project.avatar_url"
|
||||
class="avatar-container s40 project-avatar"
|
||||
>
|
||||
<project-avatar-image
|
||||
class="avatar-container project-avatar"
|
||||
:link-href="project.path"
|
||||
|
@ -34,6 +39,12 @@ export default {
|
|||
:img-size="40"
|
||||
/>
|
||||
</div>
|
||||
<identicon
|
||||
v-else
|
||||
size-class="s40"
|
||||
:entity-id="project.id"
|
||||
:entity-name="project.name"
|
||||
/>
|
||||
<div class="sidebar-context-title">
|
||||
{{ project.name }}
|
||||
</div>
|
||||
|
|
5
changelogs/unreleased/ide-project-avatar-identicon.yml
Normal file
5
changelogs/unreleased/ide-project-avatar-identicon.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Make project avatar in IDE consistent with the rest of GitLab
|
||||
merge_request:
|
||||
author:
|
||||
type: changed
|
39
spec/javascripts/ide/components/ide_project_tree_spec.js
Normal file
39
spec/javascripts/ide/components/ide_project_tree_spec.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
import Vue from 'vue';
|
||||
import ProjectTree from '~/ide/components/ide_project_tree.vue';
|
||||
import createComponent from 'spec/helpers/vue_mount_component_helper';
|
||||
|
||||
describe('IDE project tree', () => {
|
||||
const Component = Vue.extend(ProjectTree);
|
||||
let vm;
|
||||
|
||||
beforeEach(() => {
|
||||
vm = createComponent(Component, {
|
||||
project: {
|
||||
id: 1,
|
||||
name: 'test',
|
||||
web_url: gl.TEST_HOST,
|
||||
avatar_url: '',
|
||||
branches: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vm.$destroy();
|
||||
});
|
||||
|
||||
it('renders identicon when projct has no avatar', () => {
|
||||
expect(vm.$el.querySelector('.identicon')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('renders avatar image if project has avatar', done => {
|
||||
vm.project.avatar_url = gl.TEST_HOST;
|
||||
|
||||
vm.$nextTick(() => {
|
||||
expect(vm.$el.querySelector('.identicon')).toBeNull();
|
||||
expect(vm.$el.querySelector('img.avatar')).not.toBeNull();
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue