Commit 24febb8c authored by Nick Kipling's avatar Nick Kipling

Applying reviewer suggestions

Moved versions text into options inside component
Added spec for testing image src
parent bafb3952
...@@ -4,6 +4,7 @@ import { GlAvatar, GlIcon, GlLink, GlSprintf, GlTooltipDirective } from '@gitlab ...@@ -4,6 +4,7 @@ import { GlAvatar, GlIcon, GlLink, GlSprintf, GlTooltipDirective } from '@gitlab
import PackageTags from '../../shared/components/package_tags.vue'; import PackageTags from '../../shared/components/package_tags.vue';
import { numberToHumanSize } from '~/lib/utils/number_utils'; import { numberToHumanSize } from '~/lib/utils/number_utils';
import timeagoMixin from '~/vue_shared/mixins/timeago'; import timeagoMixin from '~/vue_shared/mixins/timeago';
import { __ } from '~/locale';
export default { export default {
name: 'PackageTitle', name: 'PackageTitle',
...@@ -28,6 +29,9 @@ export default { ...@@ -28,6 +29,9 @@ export default {
return numberToHumanSize(this.packageFiles.reduce((acc, p) => acc + p.size, 0)); return numberToHumanSize(this.packageFiles.reduce((acc, p) => acc + p.size, 0));
}, },
}, },
i18n: {
packageInfo: __('v%{version} published %{timeAgo}'),
},
}; };
</script> </script>
...@@ -49,7 +53,7 @@ export default { ...@@ -49,7 +53,7 @@ export default {
<div class="gl-display-flex gl-align-items-center text-secondary"> <div class="gl-display-flex gl-align-items-center text-secondary">
<gl-icon name="eye" class="gl-mr-3" /> <gl-icon name="eye" class="gl-mr-3" />
<gl-sprintf message="v%{version} published %{timeAgo}"> <gl-sprintf :message="$options.i18n.packageInfo">
<template #version> <template #version>
{{ packageEntity.version }} {{ packageEntity.version }}
</template> </template>
......
...@@ -68,11 +68,17 @@ describe('PackageTitle', () => { ...@@ -68,11 +68,17 @@ describe('PackageTitle', () => {
}); });
describe('package icon', () => { describe('package icon', () => {
it('shows an icon when provided one from vuex', () => {
const fakeSrc = 'a-fake-src'; const fakeSrc = 'a-fake-src';
it('shows an icon when provided one from vuex', () => {
createComponent({ icon: fakeSrc }); createComponent({ icon: fakeSrc });
expect(packageIcon().exists()).toBe(true); expect(packageIcon().exists()).toBe(true);
});
it('has the correct src attribute', () => {
createComponent({ icon: fakeSrc });
expect(packageIcon().props('src')).toBe(fakeSrc); expect(packageIcon().props('src')).toBe(fakeSrc);
}); });
......
...@@ -27138,6 +27138,9 @@ msgstr "" ...@@ -27138,6 +27138,9 @@ msgstr ""
msgid "uses Kubernetes clusters to deploy your code!" msgid "uses Kubernetes clusters to deploy your code!"
msgstr "" msgstr ""
msgid "v%{version} published %{timeAgo}"
msgstr ""
msgid "verify ownership" msgid "verify ownership"
msgstr "" msgstr ""
......
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