Skip to content
Merged
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
25 changes: 14 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@nextcloud/logger": "^3.0.3",
"@nextcloud/router": "^3.1.0",
"@nextcloud/sharing": "^0.4.0",
"@nextcloud/vue-select": "^4.0.0",
"@vuepic/vue-datepicker": "^11.0.3",
"@vueuse/components": "^14.2.1",
"@vueuse/core": "^14.2.1",
Expand Down Expand Up @@ -117,8 +118,7 @@
"unist-builder": "^4.0.0",
"unist-util-visit": "^5.1.0",
"vue": "^3.5.18",
"vue-router": "^5.0.4",
"vue-select": "^4.0.0-beta.6"
"vue-router": "^5.0.4"
},
"devDependencies": {
"@babel/plugin-syntax-import-assertions": "^7.28.6",
Expand Down
7 changes: 1 addition & 6 deletions src/components/NcSelect/NcSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ import {
offset,
shift,
} from '@floating-ui/dom'
import { VueSelect } from '@nextcloud/vue-select'
import { h, warn } from 'vue'
import VueSelect from 'vue-select'
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import Close from 'vue-material-design-icons/Close.vue'
import NcEllipsisedOption from '../NcEllipsisedOption/NcEllipsisedOption.vue'
Expand All @@ -405,11 +405,6 @@ import { t } from '../../l10n.ts'
import { createElementId } from '../../utils/createElementId.ts'
import { isLegacy } from '../../utils/legacy.ts'

// TODO: Use @nextcloud/vue-select once a vue 3 version is available.
// Until then, all @nextcloud/vue-select specific improvements won't be available.
// E.g. the `limit` prop has no effect, currently.
import 'vue-select/dist/vue-select.css'

export default {
name: 'NcSelect',

Expand Down
36 changes: 18 additions & 18 deletions tests/component/components/NcSelectUsers/NcSelectUsers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import UserSelect from './UserSelect.story.vue'
test('has options', async ({ mount, page }) => {
const component = await mount(UserSelect)

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').click()
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').click()

expect(await page.getByRole('option').all()).toHaveLength(3)
await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()
Expand All @@ -21,8 +21,8 @@ test('has options', async ({ mount, page }) => {
test('can filter by name', async ({ mount, page }) => {
const component = await mount(UserSelect)

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').fill('Em')
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').fill('Em')

await expect(page.getByRole('option', { name: 'Emma' })).toBeVisible()
expect(await page.getByRole('option').all()).toHaveLength(1)
Expand All @@ -31,8 +31,8 @@ test('can filter by name', async ({ mount, page }) => {
test('can filter by mail', async ({ mount, page }) => {
const component = await mount(UserSelect)

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').fill('olivia@example')
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').fill('olivia@example')

await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()
expect(await page.getByRole('option').all()).toHaveLength(1)
Expand All @@ -49,18 +49,18 @@ test(
async ({ mount, page }) => {
const component = await mount(UserSelect)

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').fill('O. <')
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').fill('O. <')

// should not exist right now as neither Name no email provided
await expect(page.getByText('No results')).toBeVisible()
expect(await page.getByRole('option', { name: 'Olivia' }).all()).toHaveLength(0)

await component.getByRole('searchbox').fill('O. <olivia')
await component.getByRole('combobox').fill('O. <olivia')
// now it should match the name
await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()

await component.getByRole('searchbox').fill('O. <olivia@example.org>')
await component.getByRole('combobox').fill('O. <olivia@example.org>')
// now it should match the email
await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()
expect(await page.getByRole('option').all()).toHaveLength(1)
Expand All @@ -75,8 +75,8 @@ test('can select option', async ({ mount, page }) => {
},
})

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').click()
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').click()

await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()
await page.getByRole('option', { name: 'Olivia' }).click()
Expand All @@ -86,8 +86,8 @@ test('can select option', async ({ mount, page }) => {
id: '0-olivia',
})

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').click()
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').click()

await expect(page.getByRole('option', { name: 'John' })).toBeVisible()
await page.getByRole('option', { name: 'John' }).click()
Expand All @@ -109,14 +109,14 @@ test('can select multiple option', async ({ mount, page }) => {
},
})

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').click()
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').click()

await expect(page.getByRole('option', { name: 'Olivia' })).toBeVisible()
await page.getByRole('option', { name: 'Olivia' }).click()

await expect(component.getByRole('searchbox')).toBeVisible()
await component.getByRole('searchbox').click()
await expect(component.getByRole('combobox')).toBeVisible()
await component.getByRole('combobox').click()
await expect(page.getByRole('option', { name: 'John' })).toBeVisible()
await page.getByRole('option', { name: 'John' }).click()

Expand Down
9 changes: 9 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export default async (env) => {
'node_modules/**',
'docs/**',
],
// @nextcloud/vue-select's ESM bundle imports its own CSS inline
// (`import './assets/*.css'` at the top of dist/index.mjs). Routing
// it through Vite's transform pipeline lets the CSS import be
// handled instead of reaching Node's native ESM loader.
server: {
deps: {
inline: ['@nextcloud/vue-select'],
},
},
},
})
}
Loading