Commit 9c54ad80 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'cngo-format-issue-list-counts' into 'master'

Format issue list counts

See merge request gitlab-org/gitlab!77986
parents a6ca930f 2a359443
<script> <script>
import { GlTabs, GlTab, GlBadge } from '@gitlab/ui'; import { GlTabs, GlTab, GlBadge } from '@gitlab/ui';
import { formatNumber } from '~/locale';
export default { export default {
components: { components: {
...@@ -29,6 +30,9 @@ export default { ...@@ -29,6 +30,9 @@ export default {
isTabCountNumeric(tab) { isTabCountNumeric(tab) {
return Number.isInteger(this.tabCounts[tab.name]); return Number.isInteger(this.tabCounts[tab.name]);
}, },
formatNumber(count) {
return formatNumber(count);
},
}, },
}; };
</script> </script>
...@@ -55,7 +59,7 @@ export default { ...@@ -55,7 +59,7 @@ export default {
size="sm" size="sm"
class="gl-tab-counter-badge" class="gl-tab-counter-badge"
> >
{{ tabCounts[tab.name] }} {{ formatNumber(tabCounts[tab.name]) }}
</gl-badge> </gl-badge>
</template> </template>
</gl-tab> </gl-tab>
......
import { GlTab, GlBadge } from '@gitlab/ui'; import { GlTab, GlBadge } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { setLanguage } from 'helpers/locale_helper';
import IssuableTabs from '~/vue_shared/issuable/list/components/issuable_tabs.vue'; import IssuableTabs from '~/vue_shared/issuable/list/components/issuable_tabs.vue';
...@@ -27,10 +28,12 @@ describe('IssuableTabs', () => { ...@@ -27,10 +28,12 @@ describe('IssuableTabs', () => {
let wrapper; let wrapper;
beforeEach(() => { beforeEach(() => {
setLanguage('en');
wrapper = createComponent(); wrapper = createComponent();
}); });
afterEach(() => { afterEach(() => {
setLanguage(null);
wrapper.destroy(); wrapper.destroy();
}); });
...@@ -71,7 +74,7 @@ describe('IssuableTabs', () => { ...@@ -71,7 +74,7 @@ describe('IssuableTabs', () => {
// Does not render `All` badge since it has an undefined count // Does not render `All` badge since it has an undefined count
expect(badges).toHaveLength(2); expect(badges).toHaveLength(2);
expect(badges.at(0).text()).toBe(`${mockIssuableListProps.tabCounts.opened}`); expect(badges.at(0).text()).toBe('5,000');
expect(badges.at(1).text()).toBe(`${mockIssuableListProps.tabCounts.closed}`); expect(badges.at(1).text()).toBe(`${mockIssuableListProps.tabCounts.closed}`);
}); });
......
...@@ -133,7 +133,7 @@ export const mockTabs = [ ...@@ -133,7 +133,7 @@ export const mockTabs = [
]; ];
export const mockTabCounts = { export const mockTabCounts = {
opened: 5, opened: 5000,
closed: 0, closed: 0,
all: undefined, all: undefined,
}; };
......
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