Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2a359443
Commit
2a359443
authored
Jan 12, 2022
by
Coung Ngo
Committed by
Olena Horal-Koretska
Jan 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format issue list counts
Format large counts with thousands separator Changelog: fixed
parent
bff05c9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
app/assets/javascripts/vue_shared/issuable/list/components/issuable_tabs.vue
...pts/vue_shared/issuable/list/components/issuable_tabs.vue
+5
-1
spec/frontend/vue_shared/issuable/list/components/issuable_tabs_spec.js
...vue_shared/issuable/list/components/issuable_tabs_spec.js
+4
-1
spec/frontend/vue_shared/issuable/list/mock_data.js
spec/frontend/vue_shared/issuable/list/mock_data.js
+1
-1
No files found.
app/assets/javascripts/vue_shared/issuable/list/components/issuable_tabs.vue
View file @
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>
...
...
spec/frontend/vue_shared/issuable/list/components/issuable_tabs_spec.js
View file @
2a359443
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
}
`
);
});
});
...
...
spec/frontend/vue_shared/issuable/list/mock_data.js
View file @
2a359443
...
@@ -133,7 +133,7 @@ export const mockTabs = [
...
@@ -133,7 +133,7 @@ export const mockTabs = [
];
];
export
const
mockTabCounts
=
{
export
const
mockTabCounts
=
{
opened
:
5
,
opened
:
5
000
,
closed
:
0
,
closed
:
0
,
all
:
undefined
,
all
:
undefined
,
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment