checked: boolean;
disabled?: boolean;
id?: string;
+ label?: string;
onCheck: (checked: boolean, id?: string) => void;
}
export function ItemCheckbox(props: ItemCheckboxProps) {
- const { checked, children, className, disabled, id, innerRef, onCheck, onFocus, ...liProps } =
- props;
+ const {
+ checked,
+ children,
+ className,
+ disabled,
+ id,
+ innerRef,
+ label,
+ onCheck,
+ onFocus,
+ ...liProps
+ } = props;
return (
<li ref={innerRef} role="none" {...liProps}>
<ItemCheckboxStyled
className={classNames(className, { disabled })}
disabled={disabled}
id={id}
+ label={label}
onCheck={onCheck}
onFocus={onFocus}
>
className={classNames('sw-flex sw-py-2 sw-px-4', { active })}
disabled={disabled}
id={element}
+ label={element}
onCheck={onSelectChange}
onFocus={onHover}
onPointerEnter={onHover}
expect(ui.tagCheckbox(tag).get()).toBeInTheDocument();
});
- // Rule already has this tag
expect(ui.tagCheckbox(RULE_TAGS_MOCK[0]).get()).toBeChecked();
// Set tag
await user.click(ui.tagCheckbox(RULE_TAGS_MOCK[1]).get());
- expect(ui.tagCheckbox(RULE_TAGS_MOCK[1]).get()).toBeChecked();
- await user.click(ui.tagCheckbox(RULE_TAGS_MOCK[1]).get());
+ await user.keyboard('{Escape}');
+ await expect(ui.tagsDropdown.byText('multi-threading').get()).toHaveATooltipWithContent(
+ 'multi-threading, awesome, cute',
+ );
+
+ await user.click(ui.tagsDropdown.get());
// Search for specific tag
await user.type(ui.tagSearch.get(), RULE_TAGS_MOCK[2]);
// Rule tags
tagsDropdown: byLabelText(/tags_list_x/).byRole('button'),
- tagCheckbox: (tag: string) => byRole('checkbox', { name: tag }),
+ tagCheckbox: (tag: string) => byLabelText(tag),
tagSearch: byRole('searchbox', { name: 'search.search_for_tags' }),
// Rule tabs