Skip to content

Commit

Permalink
FIx knockout visual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Dec 19, 2024
1 parent 2625882 commit 3a77372
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
15 changes: 8 additions & 7 deletions packages/survey-core/src/martixBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ export class QuestionMatrixBaseModel<TRow, TColumn> extends Question {
return !this.isMobile && !this.columns.some(col => !!col.width);
}
public getTableCss(): string {
const css = this.cssClasses;
return new CssClassBuilder()
.append(this.cssClasses.root)
.append(this.cssClasses.columnsAutoWidth, this.columnsAutoWidth)
.append(this.cssClasses.noHeader, !this.showHeader)
.append(this.cssClasses.hasFooter, !!this.renderedTable?.showAddRowOnBottom)
.append(this.cssClasses.rootAlternateRows, this.alternateRows)
.append(this.cssClasses.rootVerticalAlignTop, (this.verticalAlign === "top"))
.append(this.cssClasses.rootVerticalAlignMiddle, (this.verticalAlign === "middle")).toString();
.append(css.root)
.append(css.columnsAutoWidth, this.columnsAutoWidth)
.append(css.noHeader, !this.showHeader)
.append(css.hasFooter, !!this.renderedTable?.showAddRowOnBottom)
.append(css.rootAlternateRows, this.alternateRows)
.append(css.rootVerticalAlignTop, (this.verticalAlign === "top"))
.append(css.rootVerticalAlignMiddle, (this.verticalAlign === "middle")).toString();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/src/question_custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ export class QuestionCompositeModel extends QuestionCustomModelBase {
if (!this.contentPanel) return res;
return this.contentPanel.hasErrors(fireCallback, false, rec) || res;
}
public updateElementCss(reNew?: boolean) {
public updateElementCss(reNew?: boolean): void {
super.updateElementCss(reNew);
if (this.contentPanel) {
this.contentPanel.updateElementCss(reNew);
Expand Down
7 changes: 4 additions & 3 deletions packages/survey-core/src/question_matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,11 @@ export class QuestionMatrixModel
.toString();
}
public get itemSvgIcon(): string {
if (this.isPreviewStyle && this.cssClasses.itemPreviewSvgIconId) {
return this.cssClasses.itemPreviewSvgIconId;
const css = this.cssClasses;
if (this.isPreviewStyle && css.itemPreviewSvgIconId) {
return css.itemPreviewSvgIconId;
}
return this.cssClasses.itemSvgIconId;
return css.itemSvgIconId;
}
public locStrsChanged(): void {
super.locStrsChanged();
Expand Down
4 changes: 4 additions & 0 deletions packages/survey-core/src/question_matrixdropdownbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,10 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
if (dest.indexOf(ch.value) < 0) dest.push(ch.value);
}
}
public updateElementCss(reNew?: boolean): void {
super.updateElementCss(reNew);
this.getIsReadyNestedQuestions().forEach(q => q.updateElementCss(true));
}
protected runTotalsCondition(
values: HashTable<any>,
properties: HashTable<any>
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/src/question_matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
.toString();
}
public getRootCss(): string {
return new CssClassBuilder().append(super.getRootCss()).append(this.cssClasses.empty, !this.renderedTable?.showTable).toString();
return new CssClassBuilder().append(super.getRootCss()).append(this.cssClasses.empty, !this.isRendredTableCreated || !this.renderedTable.showTable).toString();
}
}

Expand Down
11 changes: 7 additions & 4 deletions packages/survey-core/src/question_multipletext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,15 @@ export class QuestionMultipleTextModel extends Question
}
return result;
}
public clearErrors() {
public clearErrors(): void {
super.clearErrors();
for (var i = 0; i < this.items.length; i++) {
this.items[i].editor.clearErrors();
}
this.items.forEach(item => item.editor.clearErrors());
}
public updateElementCss(reNew?: boolean): void {
super.updateElementCss(reNew);
this.items.forEach(item => item.editor.updateElementCss(true));
}

protected getContainsErrors(): boolean {
var res = super.getContainsErrors();
if (res) return res;
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/src/question_paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2339,7 +2339,7 @@ export class QuestionPanelDynamicModel extends Question
}
return questionPlainData;
}
public updateElementCss(reNew?: boolean) {
public updateElementCss(reNew?: boolean): void {
super.updateElementCss(reNew);
for (var i = 0; i < this.panelsCore.length; i++) {
var el = this.panelsCore[i];
Expand Down

0 comments on commit 3a77372

Please sign in to comment.