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
3 changes: 3 additions & 0 deletions src/components/NcEllipsisedOption/NcEllipsisedOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ export default {

<template>
<span dir="auto" class="name-parts" :title="name">
<span class="hidden-visually" v-text="name" />
<NcHighlight
aria-hidden="true"
class="name-parts__first"
:text="part1"
:search="search"
:highlight="highlight1" />
<NcHighlight
v-if="part2"
aria-hidden="true"
class="name-parts__last"
:text="part2"
:search="search"
Expand Down
25 changes: 25 additions & 0 deletions tests/component/components/NcSelect.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { expect, test } from '@playwright/experimental-ct-vue'
import NcSelect from '../../../src/components/NcSelect/NcSelect.vue'

/**
* Previously due to NcEllipsedOption long option names
* were shown as "Verylongo ptionname" due to whitespace between <span> elements.
*/
test('Options have proper accessible names', async ({ mount, page }) => {
const component = await mount(NcSelect, {
props: {
options: ['Short', 'Verylongoptionnamethatlikelyoverflows'],
},
})

await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').fill('Very')

console.error(await page.getByRole('option', { name: /Veryl/ }).innerHTML())
await expect(page.getByRole('option', { name: 'Verylongoptionnamethatlikelyoverflows' })).toBeVisible()
})
Loading