diff --git a/app/assets/javascripts/super_sidebar/components/counter.vue b/app/assets/javascripts/super_sidebar/components/counter.vue
index 01ea970ddd6b705bd0c226ccc625d02a42ee7511..a386d63cf90abee1633859d20531aedc1b1ef145 100644
--- a/app/assets/javascripts/super_sidebar/components/counter.vue
+++ b/app/assets/javascripts/super_sidebar/components/counter.vue
@@ -28,7 +28,7 @@ export default {
},
computed: {
ariaLabel() {
- return `${this.label} ${this.count}`;
+ return `${this.count} ${this.label}`;
},
component() {
return this.href ? 'a' : 'button';
@@ -39,6 +39,9 @@ export default {
}
return this.count;
},
+ countExists() {
+ return this.count.toString();
+ },
},
};
@@ -51,7 +54,7 @@ export default {
class="dashboard-shortcuts-button gl-relative gl-flex gl-items-center gl-justify-center"
>
- {{
+ {{
formattedCount
}}
diff --git a/spec/frontend/super_sidebar/components/counter_spec.js b/spec/frontend/super_sidebar/components/counter_spec.js
index 37cebb35e6b32f71b82ea258a8599b96264bffc9..48d57e0d0483ee5a18f69e8243cd681648cd5642 100644
--- a/spec/frontend/super_sidebar/components/counter_spec.js
+++ b/spec/frontend/super_sidebar/components/counter_spec.js
@@ -38,7 +38,7 @@ describe('Counter component', () => {
});
it('renders button', () => {
- expect(findButton().attributes('aria-label')).toBe('Issues 3');
+ expect(findButton().attributes('aria-label')).toBe('3 Issues');
expect(findLink().exists()).toBe(false);
});
});
@@ -46,7 +46,7 @@ describe('Counter component', () => {
describe('link', () => {
it('renders link', () => {
createWrapper({ href: '/dashboard/todos' });
- expect(findLink().attributes('aria-label')).toBe('Issues 3');
+ expect(findLink().attributes('aria-label')).toBe('3 Issues');
expect(findLink().attributes('href')).toBe('/dashboard/todos');
expect(findButton().exists()).toBe(false);
});
@@ -57,7 +57,7 @@ describe('Counter component', () => {
['110%', '110%'],
[100, '99+'],
[10, '10'],
- [0, ''],
+ [0, '0'],
])('formats count %p as %p', (count, result) => {
createWrapper({ count });
expect(findButton().text()).toBe(result);