mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-28 19:58:11 +08:00
playwright : add data-testids for new test (#13364)
### What problem does this PR solve? add data-testids for new test ### Type of change - [x] Other (please describe): add data-testids for new test
This commit is contained in:
@@ -13,9 +13,17 @@ type RadioProps = {
|
||||
disabled?: boolean;
|
||||
onChange?: (checked: boolean) => void;
|
||||
children?: React.ReactNode;
|
||||
testId?: string;
|
||||
};
|
||||
|
||||
function Radio({ value, checked, disabled, onChange, children }: RadioProps) {
|
||||
function Radio({
|
||||
value,
|
||||
checked,
|
||||
disabled,
|
||||
onChange,
|
||||
children,
|
||||
testId,
|
||||
}: RadioProps) {
|
||||
const groupContext = useContext(RadioGroupContext);
|
||||
const isControlled = checked !== undefined;
|
||||
// const [internalChecked, setInternalChecked] = useState(false);
|
||||
@@ -54,6 +62,7 @@ function Radio({ value, checked, disabled, onChange, children }: RadioProps) {
|
||||
mergedDisabled && 'border-muted',
|
||||
)}
|
||||
onClick={handleClick}
|
||||
data-testid={testId}
|
||||
>
|
||||
{isChecked && (
|
||||
<div className="h-3 w-3 fill-primary text-primary bg-text-primary rounded-full" />
|
||||
|
||||
@@ -203,6 +203,8 @@ export type RAGFlowSelectProps = Partial<ControllerRenderProps> & {
|
||||
contentProps?: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>;
|
||||
triggerClassName?: string;
|
||||
onlyShowSelectedIcon?: boolean;
|
||||
triggerTestId?: string;
|
||||
optionTestIdPrefix?: string;
|
||||
} & SelectPrimitive.SelectProps;
|
||||
|
||||
/**
|
||||
@@ -237,6 +239,8 @@ export const RAGFlowSelect = forwardRef<
|
||||
// defaultValue,
|
||||
triggerClassName,
|
||||
onlyShowSelectedIcon = false,
|
||||
triggerTestId,
|
||||
optionTestIdPrefix,
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
@@ -301,6 +305,7 @@ export const RAGFlowSelect = forwardRef<
|
||||
allowClear={allowClear}
|
||||
ref={ref}
|
||||
className={triggerClassName}
|
||||
data-testid={triggerTestId}
|
||||
>
|
||||
<SelectValue placeholder={placeholder}>{label}</SelectValue>
|
||||
</SelectTrigger>
|
||||
@@ -313,6 +318,11 @@ export const RAGFlowSelect = forwardRef<
|
||||
value={o.value as RAGFlowSelectOptionType['value']}
|
||||
key={o.value}
|
||||
disabled={o.disabled}
|
||||
data-testid={
|
||||
optionTestIdPrefix
|
||||
? `${optionTestIdPrefix}-${o.value}`
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<div className="flex items-center gap-1">
|
||||
{o.icon}
|
||||
@@ -326,7 +336,16 @@ export const RAGFlowSelect = forwardRef<
|
||||
<SelectGroup key={idx}>
|
||||
<SelectLabel className="pl-2">{o.label}</SelectLabel>
|
||||
{o.options.map((x) => (
|
||||
<SelectItem value={x.value} key={x.value} disabled={x.disabled}>
|
||||
<SelectItem
|
||||
value={x.value}
|
||||
key={x.value}
|
||||
disabled={x.disabled}
|
||||
data-testid={
|
||||
optionTestIdPrefix
|
||||
? `${optionTestIdPrefix}-${x.value}`
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{x.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user