Skip to content

Commit 79a709a

Browse files
authored
fix(FilterGroupItem): don't show colon if label is empty (#4529)
Fixes #4513
1 parent 9e087c1 commit 79a709a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/main/src/components/FilterBar/FilterBar.cy.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,24 @@ describe('FilterBar.cy.tsx', () => {
431431
cy.get('@search').should('have.callCount', 11);
432432
});
433433

434+
it('show no colon for empty label', () => {
435+
cy.mount(
436+
<FilterBar>
437+
<FilterGroupItem>
438+
<Input />
439+
</FilterGroupItem>
440+
<FilterGroupItem label="Input">
441+
<Input placeholder="Placeholder" />
442+
</FilterGroupItem>
443+
</FilterBar>
444+
);
445+
446+
cy.get('[show-colon="true"]').should('have.length', 1);
447+
cy.findByText('Filters').click();
448+
cy.findByText('Show Values').click();
449+
cy.get('[show-colon="true"]').should('have.length', 2);
450+
});
451+
434452
mountWithCustomTagName(FilterBar);
435453

436454
cypressPassThroughTestsFactory(FilterBar);

packages/main/src/components/FilterGroupItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const FilterGroupItem = forwardRef<HTMLDivElement, FilterGroupItemPropTyp
118118
className={classes.dialogCellLabel}
119119
title={labelTooltip ?? label}
120120
required={required}
121-
showColon={withValues}
121+
showColon={!!label && withValues}
122122
>
123123
{label}
124124
</Label>
@@ -138,7 +138,7 @@ export const FilterGroupItem = forwardRef<HTMLDivElement, FilterGroupItemPropTyp
138138
<div ref={ref} slot={slot} {...rest} className={clsx(classes.filterItem, className)}>
139139
<div className={inFB ? classes.innerFilterItemContainer : classes.innerFilterItemContainerDialog}>
140140
<FlexBox>
141-
<Label title={labelTooltip ?? label} required={required} showColon>
141+
<Label title={labelTooltip ?? label} required={required} showColon={!!label}>
142142
{`${considerGroupName && groupName !== 'default' ? `${groupName}: ` : ''}
143143
${label}`}
144144
</Label>

0 commit comments

Comments
 (0)