Skip to content

Commit

Permalink
Title for panel in-row rendered incorrectly (#8658)
Browse files Browse the repository at this point in the history
  • Loading branch information
novikov82 authored Aug 7, 2024
1 parent 20a39fd commit 74cd59f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/defaultCss/defaultV2Css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export var defaultV2Css = {
footer: "sd-panel__footer",
requiredText: "sd-panel__required-text",
header: "sd-panel__header sd-element__header sd-element__header--location-top",
headerHidden: "sd-panel__header--hidden",
collapsed: "sd-element--collapsed",
expanded: "sd-element--expanded",
expandable: "sd-element--expandable",
Expand Down
8 changes: 8 additions & 0 deletions src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,14 @@ export class PanelModel extends PanelModelBase implements IElement {
this.onIndentChanged();
this.calcHasTextInTitle();
}
public get cssHeader(): string {
return new CssClassBuilder()
.append(this.cssClasses.panel.header)
.append(this.cssClasses.panel.headerHidden,
!this.hasTextInTitle &&
!this.hasDescription &&
this.isDesignMode).toString();
}
public get isPanel(): boolean {
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/paneltests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2790,7 +2790,9 @@ QUnit.test("panel check title in design mode", function (assert) {
var oldCss = survey.css.panel.titleHidden;
var oldRootCss = survey.css.root;
survey.css.root = "sd-root-modern";
survey.css.panel.header = "sv_p_header";
survey.css.panel.titleHidden = "sv_p_title--hidden";
survey.css.panel.headerHidden = "sv_p_header--hidden";

survey.setJsonObject({
questions: [
Expand All @@ -2809,8 +2811,10 @@ QUnit.test("panel check title in design mode", function (assert) {
const panel = <PanelModel>survey.getAllPanels()[0];
assert.equal(panel.hasTitle, false);
assert.equal(panel.cssTitle, "sv_p_title");
assert.equal(panel.cssHeader, "sv_p_header");
survey.setDesignMode(true);
assert.equal(panel.hasTitle, true);
assert.equal(panel.cssHeader, "sv_p_header sv_p_header--hidden");
assert.equal(panel.cssTitle, "sv_p_title sv_p_title--hidden");
survey.css.panel.titleHidden = oldCss;
survey.css.root = oldRootCss;
Expand Down

0 comments on commit 74cd59f

Please sign in to comment.