Commit 3aae4611 authored by Phil Hughes's avatar Phil Hughes Committed by Natalia Tepluhina

Fixed placeholder note avatar size

parent cf22999b
...@@ -39,6 +39,11 @@ export default { ...@@ -39,6 +39,11 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
...mapGetters(['getUserData']), ...mapGetters(['getUserData']),
...@@ -46,9 +51,10 @@ export default { ...@@ -46,9 +51,10 @@ export default {
return renderMarkdown(this.note.body); return renderMarkdown(this.note.body);
}, },
avatarSize() { avatarSize() {
if (this.line) { if (this.line && !this.isOverviewTab) {
return 16; return 24;
} }
return 40; return 40;
}, },
}, },
......
...@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import IssuePlaceholderNote from '~/vue_shared/components/notes/placeholder_note.vue'; import IssuePlaceholderNote from '~/vue_shared/components/notes/placeholder_note.vue';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import { userDataMock } from '../../../notes/mock_data'; import { userDataMock } from '../../../notes/mock_data';
Vue.use(Vuex); Vue.use(Vuex);
...@@ -15,7 +16,7 @@ describe('Issue placeholder note component', () => { ...@@ -15,7 +16,7 @@ describe('Issue placeholder note component', () => {
const findNote = () => wrapper.find({ ref: 'note' }); const findNote = () => wrapper.find({ ref: 'note' });
const createComponent = (isIndividual = false) => { const createComponent = (isIndividual = false, propsData = {}) => {
wrapper = shallowMount(IssuePlaceholderNote, { wrapper = shallowMount(IssuePlaceholderNote, {
store: new Vuex.Store({ store: new Vuex.Store({
getters, getters,
...@@ -25,6 +26,7 @@ describe('Issue placeholder note component', () => { ...@@ -25,6 +26,7 @@ describe('Issue placeholder note component', () => {
body: 'Foo', body: 'Foo',
individual_note: isIndividual, individual_note: isIndividual,
}, },
...propsData,
}, },
}); });
}; };
...@@ -51,4 +53,17 @@ describe('Issue placeholder note component', () => { ...@@ -51,4 +53,17 @@ describe('Issue placeholder note component', () => {
expect(findNote().classes()).toContain('discussion'); expect(findNote().classes()).toContain('discussion');
}); });
describe('avatar size', () => {
it.each`
size | line | isOverviewTab
${40} | ${null} | ${false}
${24} | ${{ line_code: '123' }} | ${false}
${40} | ${{ line_code: '123' }} | ${true}
`('renders avatar $size for $line and $isOverviewTab', ({ size, line, isOverviewTab }) => {
createComponent(false, { line, isOverviewTab });
expect(wrapper.findComponent(UserAvatarLink).props('imgSize')).toBe(size);
});
});
}); });
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