Skip to content
代码片段 群组 项目
未验证 提交 dd00b04a 编辑于 作者: Bojan Marjanovic's avatar Bojan Marjanovic 提交者: GitLab
浏览文件

Use String for association count

On organization front page
上级 b7a144b2
No related branches found
No related tags found
无相关合并请求
<script>
import { GlIcon, GlLink, GlCard } from '@gitlab/ui';
import { numberToMetricPrefix } from '~/lib/utils/number_utils';
import { __ } from '~/locale';
export default {
......@@ -16,7 +15,7 @@ export default {
required: true,
},
count: {
type: Number,
type: String,
required: true,
},
linkHref: {
......@@ -29,11 +28,6 @@ export default {
default: __('View all'),
},
},
computed: {
formattedCount() {
return numberToMetricPrefix(this.count, 0);
},
},
};
</script>
......@@ -48,7 +42,7 @@ export default {
</div>
<span
class="gl-font-size-h-display gl-font-weight-bold gl-line-height-ratio-1000 gl-mt-2 gl-display-block"
>{{ formattedCount }}</span
>{{ count }}</span
>
</gl-card>
</template>
......@@ -8,7 +8,7 @@ describe('AssociationCountCard', () => {
const defaultPropsData = {
title: 'Groups',
iconName: 'group',
count: 1050,
count: '1000+',
linkHref: '/-/organizations/default/groups_and_projects?display=groups',
};
......@@ -28,7 +28,7 @@ describe('AssociationCountCard', () => {
const link = findLink();
expect(card.text()).toContain(defaultPropsData.title);
expect(card.text()).toContain('1k');
expect(card.text()).toContain('1000+');
expect(link.text()).toBe('View all');
expect(link.attributes('href')).toBe(defaultPropsData.linkHref);
});
......
......@@ -7,9 +7,9 @@ describe('AssociationCounts', () => {
const defaultPropsData = {
associationCounts: {
groups: 10,
projects: 5,
users: 6,
groups: '10',
projects: '5',
users: '1000+',
},
groupsAndProjectsOrganizationPath: '/-/organizations/default/groups_and_projects',
usersOrganizationPath: '/-/organizations/default/users',
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册