diff --git a/src/views/OfficeOverview.spec.ts b/src/views/OfficeOverview.spec.ts index 731bfaea..31c2c853 100644 --- a/src/views/OfficeOverview.spec.ts +++ b/src/views/OfficeOverview.spec.ts @@ -200,6 +200,15 @@ describe('OfficeOverview > rendering states', () => { expect(wrapper.findComponent({ name: 'NcEmptyContent' }).props('name')).toBe('No office suite installed') }) + it('announces the pluralised number of files found', async () => { + getTemplatesMock.mockResolvedValue([makeCreator()]) + getAllOfficeFilesMock.mockResolvedValue(officeFilesResult([makeNode({ owner: 'alice' }), makeNode({ owner: 'alice' })])) + + const wrapper = await mountOverview() + + expect(wrapper.find('[role="status"]').text()).toBe('2 files found in Documents') + }) + it('shows "No {category} found" with a switch-to-All hint when the mine filter has no matches', async () => { getTemplatesMock.mockResolvedValue([makeCreator()]) getAllOfficeFilesMock.mockResolvedValue(officeFilesResult([])) // nothing matches "mine" (the default filter) diff --git a/src/views/OfficeOverview.vue b/src/views/OfficeOverview.vue index 8733de61..190aa446 100644 --- a/src/views/OfficeOverview.vue +++ b/src/views/OfficeOverview.vue @@ -7,7 +7,7 @@ import { computed, nextTick, ref, watch } from 'vue' import { useRoute, useRouter } from 'vue-router' import { getCurrentUser } from '@nextcloud/auth' -import { translate as t } from '@nextcloud/l10n' +import { translate as t, translatePlural as n } from '@nextcloud/l10n' import { loadState } from '@nextcloud/initial-state' import { generateUrl } from '@nextcloud/router' import NcAppContent from '@nextcloud/vue/components/NcAppContent' @@ -291,7 +291,7 @@ fetchAll()
- {{ t('office', '{count} found in {category}', { count: files.length, category: activeCategoryName }) }} + {{ n('office', '%n file found in {category}', '%n files found in {category}', files.length, { category: activeCategoryName }) }}