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

Do not render expansion panel description if unused #1129

Merged
merged 2 commits into from
Dec 5, 2024
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
3 changes: 1 addition & 2 deletions mesop/components/expansion_panel/e2e/expansion_panel_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def app():
me.text("Pineapple content.")

with me.expansion_panel(
title="Cantalope title",
description="Type of fruit",
title="Cantalope (no description)",
hide_toggle=True,
):
me.text("Cantalope content.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.describe('Expansion Panel', () => {
await page
.locator('[aria-disabled="false"] span.mat-content-hide-toggle')
.textContent(),
).toContain('Cantalope title');
).toContain('Cantalope (no description)');
});
});

Expand Down
2 changes: 2 additions & 0 deletions mesop/components/expansion_panel/expansion_panel.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
>
<mat-expansion-panel-header>
<mat-panel-title>{{config().getTitle()}}</mat-panel-title>
@if (config().getDescription()) {
<mat-panel-description>
{{config().getDescription()}} @if (config().getIcon()) {
<mat-icon>{{config().getIcon()}}</mat-icon>
}
</mat-panel-description>
}
</mat-expansion-panel-header>
<ng-content></ng-content>
</mat-expansion-panel>
Loading