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