Skip to content

Commit

Permalink
Merge branch 'master' of github.com:surveyjs/survey-creator into issu…
Browse files Browse the repository at this point in the history
…e/6349-popup-shadow-color-calculation
  • Loading branch information
OlgaLarina committed Dec 30, 2024
2 parents b472c45 + 95f5b15 commit ed61df8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 53 deletions.
11 changes: 0 additions & 11 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3455,17 +3455,6 @@ export class SurveyCreatorModel extends Base
}
return options.sortOrder;
}
onConditionGetTitleCallback(
expression: string,
title: string
): string {
var options = {
expression: expression,
title: title,
};
this.onConditionGetTitle.fire(this, options);
return options.title;
}
isConditionOperatorEnabled(questionName: string, question: Question, operator: string, isEnabled: boolean): boolean {
if (this.onGetConditionOperator.isEmpty) return isEnabled;
const options = {
Expand Down
10 changes: 0 additions & 10 deletions packages/survey-creator-core/src/creator-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,6 @@ export interface ISurveyCreatorOptions {
list: any[],
variables: string[]
): string;
onConditionGetTitleCallback(
expression: string,
title: string
): string;
isConditionOperatorEnabled(questionName: string, question: Question, operator: string, isEnabled: boolean): boolean;
onLogicGetTitleCallback(
expression: string,
Expand Down Expand Up @@ -474,12 +470,6 @@ export class EmptySurveyCreatorOptions implements ISurveyCreatorOptions {
list: any[],
variables: string[]
): string { return "asc"; }
onConditionGetTitleCallback(
expression: string,
title: string
): string {
return title;
}
isConditionOperatorEnabled(questionName: string, question: Question, operator: string, isEnabled: boolean): boolean { return isEnabled; }
onLogicGetTitleCallback(
expression: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -999,13 +999,8 @@ export class ConditionEditor extends PropertyEditorSetupValue {
panel.getQuestionByName("removeAction").visible = options.value.length !== 1;
});
}
this.setTitle();
this.title = this.isReady ? this.text : editorLocalization.getString("pe.ruleIsNotSet");
}
private setTitle() {
const text = this.isReady ? this.text : "";
this.title = this.options.onConditionGetTitleCallback(text, text || editorLocalization.getString("pe.ruleIsNotSet"));
}

private showTextEditor(expression: string) {
this.panel.visible = false;
this.textEditor.value = expression;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,6 @@ test("Add condition", () => {
expect(conditionEditor.text).toEqual("{q} = 1 and {q2} = 2");
expect(conditionEditor.title).toEqual("{q} = 1 and {q2} = 2");
});
test("Custom text for condition title", () => {
const survey = new SurveyModel({
questions: [
{ type: "text", name: "q1" },
{ type: "text", name: "q" },
{ type: "text", name: "q2" }
]
});
const options = new EmptySurveyCreatorOptions();
options.onConditionGetTitleCallback = (expression: string, title: string): string => {
if (!expression) return "Please setup the expression";
return "Your expression is: " + title;
};
const conditionEditor = new ConditionEditor(survey, survey.getQuestionByName("q1"), options);
expect(conditionEditor.title).toEqual("Please setup the expression");
conditionEditor.text = "{q} = 1";
expect(conditionEditor.title).toEqual("Your expression is: {q} = 1");
conditionEditor.panel.addPanel();
expect(conditionEditor.title).toEqual("Please setup the expression");
var editPanel = conditionEditor.panel.panels[1];
var nameQuestion = editPanel.getQuestionByName("questionName");
nameQuestion.value = "q2";
editPanel.getQuestionByName("questionValue").value = 2;
expect(conditionEditor.title).toEqual("Your expression is: {q} = 1 and {q2} = 2");
});

test("Do not delete the only condition, but clear it", () => {
var survey = new SurveyModel({
questions: [
Expand Down

0 comments on commit ed61df8

Please sign in to comment.