Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: not showing badge when dropdown is multiple and button is circular #1185

Merged
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
2 changes: 1 addition & 1 deletion projects/ion/src/lib/button/button.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ion-badge
[value]="buttonBadge?.value"
[type]="buttonBadge?.type"
*ngIf="multiple && !loading"
*ngIf="multiple && !loading && !circularButton"
data-testid="badge-multiple"
></ion-badge>
</button>
Expand Down
11 changes: 11 additions & 0 deletions projects/ion/src/lib/button/button.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ describe('ButtonComponent with dropdown', () => {
expect(screen.getByTestId('badge-multiple')).toBeInTheDocument();
expect(screen.getByTestId('badge-multiple')).toHaveTextContent('0');
});

it('should not render an ion-badge when the dropdown is set to multiple but the button is circular', async () => {
await sut({
label: defaultName,
multiple: true,
circularButton: true,
options: [{ label: 'Option 1' }, { label: 'Option 2' }],
});

expect(screen.queryByTestId('badge-multiple')).not.toBeInTheDocument();
});
});

it('should emit an event when option is selected', async () => {
Expand Down
24 changes: 24 additions & 0 deletions stories/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,30 @@ O Ion, Suporta 4 tamanhos padrões para botões. Basta configurar a propriedade
template: `<ion-button label="Primary" [options]="[{ label: 'option 1' }, {label: 'option 2'}]" multiple="true"></ion-button>`,
}}
</Story>
<Story
name="with dropdown: circular button with multiple choices"
decorators={[moduleMetadata({ imports: [CommonModule, IonSharedModule] })]}
>
{{
template: `
<ion-button
type="ghost"
iconType="config"
[options]="[
{ label: 'Ocioso', icon: 'clock-stopwatch' },
{ label: 'Em deslocamento', icon: 'motorcycle' },
{ label: 'Trabalhando', icon: 'working' }
]"
[dropdownConfig]="{
notShowClearButton: true,
description: 'Status para acompanhar'
}"
[circularButton]="true"
[multiple]="true"
></ion-button>
`,
}}
</Story>
<Story
name="with dropdown with title"
decorators={[
Expand Down
Loading