Skip to content

Commit

Permalink
Do not render expansion panel description if unused (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen authored Dec 5, 2024
1 parent 5212217 commit 721219a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
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>

0 comments on commit 721219a

Please sign in to comment.