Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/views/OfficeOverview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/views/OfficeOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -291,7 +291,7 @@ fetchAll()

<section v-else-if="activeCreator" class="office-overview__files" aria-labelledby="files-section-heading">
<div role="status" class="sr-only">
{{ 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 }) }}
</div>

<div class="office-overview__files-header">
Expand Down
Loading