onCreate('')}
- className={cn(
- 'flex cursor-pointer items-center gap-2 rounded-lg px-3 py-[6px] hover:bg-state-base-hover',
+
+
+ {curNav?.name}
+
+
+
+
+ {
+ navigationItems.map(nav => (
+
{
+ if (curNav?.id === nav.id)
+ return
+ setAppDetail()
+ router.push(nav.link)
+ }}
+ title={nav.name}
+ >
+
+
+ {!!nav.mode && (
+
)}
- >
-
-
-
-
{createText}
-
- )}
- {isApp && isCurrentWorkspaceEditor && (
-
- )}
-
- >
- )}
-
+
+ {nav.name}
+
+
+ ))
+ }
+ {isLoadingMore && (
+
+
+
+ )}
+
+ {!isApp && isCurrentWorkspaceEditor && (
+
+
onCreate('')}
+ >
+
+
+
+ {createText}
+
+
+ )}
+ {isApp && isCurrentWorkspaceEditor && (
+
+ )}
+
+
)
}
diff --git a/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.branches.spec.tsx b/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.branches.spec.tsx
index 38fa62a728..9ca932e54c 100644
--- a/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.branches.spec.tsx
+++ b/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.branches.spec.tsx
@@ -2,6 +2,7 @@ import type { ComponentProps } from 'react'
import type { CredentialFormSchema, FormOption } from '@/app/components/header/account-setting/model-provider-page/declarations'
import type { AppSelectorValue } from '@/app/components/plugins/plugin-detail-panel/app-selector'
import { fireEvent, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { PluginCategoryEnum } from '@/app/components/plugins/types'
import { renderWorkflowFlowComponent } from '@/app/components/workflow/__tests__/workflow-test-env'
@@ -207,7 +208,8 @@ describe('FormInputItem branches', () => {
})
})
- it('should render static multi-select values and update selected labels', () => {
+ it('should render static multi-select values and update selected labels', async () => {
+ const user = userEvent.setup()
const { onChange } = renderFormInputItem({
schema: createSchema({
multiple: true,
@@ -226,8 +228,8 @@ describe('FormInputItem branches', () => {
})
expect(screen.getByText('alpha')).toBeInTheDocument()
- fireEvent.click(screen.getByText('alpha').closest('button') as HTMLButtonElement)
- fireEvent.click(screen.getByText('beta'))
+ await user.click(screen.getByRole('combobox', { name: 'alpha' }))
+ await user.click(await screen.findByRole('option', { name: 'beta' }))
expect(onChange).toHaveBeenCalledWith({
field: {
diff --git a/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.sections.spec.tsx b/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.sections.spec.tsx
index 9a98e60483..34382f2be0 100644
--- a/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.sections.spec.tsx
+++ b/web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.sections.spec.tsx
@@ -1,4 +1,5 @@
-import { fireEvent, screen } from '@testing-library/react'
+import { screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { renderWorkflowComponent } from '@/app/components/workflow/__tests__/workflow-test-env'
import {
JsonEditorField,
@@ -18,7 +19,7 @@ describe('form-input-item sections', () => {
/>,
)
- expect(screen.getByText('Loading...')).toBeInTheDocument()
+ expect(screen.getByRole('combobox', { name: 'Options' })).toHaveTextContent('Loading')
})
it('should render the shared json editor section', () => {
@@ -33,7 +34,8 @@ describe('form-input-item sections', () => {
expect(screen.getByText('JSON')).toBeInTheDocument()
})
- it('should render placeholder, icons, and select multi-select options', () => {
+ it('should render placeholder, icons, and select multi-select options', async () => {
+ const user = userEvent.setup()
const onChange = vi.fn()
renderWorkflowComponent(
@@ -51,8 +53,8 @@ describe('form-input-item sections', () => {
)
expect(screen.getByText('Choose options')).toBeInTheDocument()
- fireEvent.click(screen.getByRole('button'))
- fireEvent.click(screen.getByText('Alpha'))
+ await user.click(screen.getByRole('combobox', { name: 'Choose options' }))
+ await user.click(await screen.findByRole('option', { name: 'Alpha' }))
expect(document.querySelector('img[src="/alpha.svg"]')).toBeInTheDocument()
expect(onChange).toHaveBeenCalled()
diff --git a/web/app/components/workflow/nodes/_base/components/form-input-item.sections.tsx b/web/app/components/workflow/nodes/_base/components/form-input-item.sections.tsx
index 84cfb4629d..896250508c 100644
--- a/web/app/components/workflow/nodes/_base/components/form-input-item.sections.tsx
+++ b/web/app/components/workflow/nodes/_base/components/form-input-item.sections.tsx
@@ -2,10 +2,16 @@
import type { FC, ReactElement } from 'react'
import type { SelectItem } from './form-input-item.helpers'
-import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from '@headlessui/react'
-import { ChevronDownIcon } from '@heroicons/react/20/solid'
import { cn } from '@langgenius/dify-ui/cn'
-import { RiCheckLine, RiLoader4Line } from '@remixicon/react'
+import {
+ SelectItem as DifySelectItem,
+ Select,
+ SelectContent,
+ SelectItemIndicator,
+ SelectItemText,
+ SelectTrigger,
+} from '@langgenius/dify-ui/select'
+import { RiLoader4Line } from '@remixicon/react'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
@@ -20,20 +26,7 @@ type MultiSelectFieldProps = {
}
const LoadingIndicator = () => (
-
-)
-
-const ToggleIndicator = () => (
-
-)
-
-const SelectedMark = () => (
-
-
-
+
)
export const MultiSelectField: FC
= ({
@@ -56,48 +49,44 @@ export const MultiSelectField: FC = ({
const renderLabel = () => {
if (isLoading)
- return 'Loading...'
+ return 'Loading…'
return selectedLabel || placeholder || 'Select options'
}
return (
-
-
-
-
+
)
}