Skip to content

Commit

Permalink
Enable "Refuse to answer" inside matrix columns fix #5392 (#5397)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Apr 10, 2024
1 parent e88639b commit 99de9cd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/survey-creator-core/src/question-editor/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ const defaultProperties: ISurveyPropertiesDefinition = {
{ name: "showSelectAllItem", tab: "choices" },
{ name: "showNoneItem", tab: "choices" },
{ name: "noneText", tab: "choices" },
{ name: "showRefuseItem", tab: "choices" },
{ name: "refuseText", tab: "choices" },
{ name: "showDontKnowItem", tab: "choices" },
{ name: "dontKnowText", tab: "choices" },
{ name: "minSelectedChoices", tab: "choices" },
{ name: "maxSelectedChoices", tab: "choices" },
{ name: "selectAllText", tab: "choices" },
Expand All @@ -461,6 +465,10 @@ const defaultProperties: ISurveyPropertiesDefinition = {
{ name: "colCount", tab: "choices" },
{ name: "showNoneItem", tab: "choices" },
{ name: "noneText", tab: "choices" },
{ name: "showRefuseItem", tab: "choices" },
{ name: "refuseText", tab: "choices" },
{ name: "showDontKnowItem", tab: "choices" },
{ name: "dontKnowText", tab: "choices" },
{ name: "choicesVisibleIf", tab: "logic" },
{ name: "choicesEnableIf", tab: "logic" },
],
Expand All @@ -481,6 +489,10 @@ const defaultProperties: ISurveyPropertiesDefinition = {
{ name: "optionsCaption", tab: "choices" },
{ name: "showNoneItem", tab: "choices" },
{ name: "noneText", tab: "choices" },
{ name: "showRefuseItem", tab: "choices" },
{ name: "refuseText", tab: "choices" },
{ name: "showDontKnowItem", tab: "choices" },
{ name: "dontKnowText", tab: "choices" },
{ name: "choicesMin", tab: "choices" },
{ name: "choicesMax", tab: "choices" },
{ name: "choicesStep", tab: "choices" },
Expand All @@ -504,6 +516,10 @@ const defaultProperties: ISurveyPropertiesDefinition = {
{ name: "optionsCaption", tab: "choices" },
{ name: "showNoneItem", tab: "choices" },
{ name: "noneText", tab: "choices" },
{ name: "showRefuseItem", tab: "choices" },
{ name: "refuseText", tab: "choices" },
{ name: "showDontKnowItem", tab: "choices" },
{ name: "dontKnowText", tab: "choices" },
{ name: "choicesMin", tab: "choices" },
{ name: "choicesMax", tab: "choices" },
{ name: "choicesStep", tab: "choices" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
QuestionCommentModel,
QuestionImagePickerModel,
ComponentCollection,
QuestionBooleanModel
QuestionBooleanModel,
QuestionRadiogroupModel
} from "survey-core";
import {
EmptySurveyCreatorOptions,
Expand Down Expand Up @@ -3301,6 +3302,35 @@ test("surveypages property editor & default value", () => {

Serializer.removeProperty("survey", "name");
});
test("showRefuseItem&showDontKnowItem in question&column", () => {
const question = new QuestionRadiogroupModel("q1");
const matrix = new QuestionMatrixDynamicModel("q2");
const column = matrix.addColumn("col1");
column.cellType = "dropdown";
const prop1 = Serializer.findProperty("selectbase", "showRefuseItem");
const prop2 = Serializer.findProperty("selectbase", "showDontKnowItem");
expect(prop1.visible).toBeFalsy();
let propertyGrid = new PropertyGridModelTester(question);
expect(propertyGrid.survey.getQuestionByName("showRefuseItem")).toBeFalsy();
prop1.visible = true;
prop2.visible = true;
propertyGrid = new PropertyGridModelTester(question);
let survey = propertyGrid.survey;
expect(survey.getQuestionByName("showRefuseItem")).toBeTruthy();
expect(survey.getQuestionByName("showDontKnowItem")).toBeTruthy();
expect(survey.getQuestionByName("refuseText")).toBeTruthy();
expect(survey.getQuestionByName("dontKnowText")).toBeTruthy();

propertyGrid = new PropertyGridModelTester(column);
survey = propertyGrid.survey;
expect(survey.getQuestionByName("showRefuseItem")).toBeTruthy();
expect(survey.getQuestionByName("showDontKnowItem")).toBeTruthy();
expect(survey.getQuestionByName("refuseText")).toBeTruthy();
expect(survey.getQuestionByName("dontKnowText")).toBeTruthy();

prop1.visible = false;
prop2.visible = false;
});
test("It is impossible to clear value for numeric property, bug##5395", () => {
const question = new QuestionImagePickerModel("q1");
const propertyGrid = new PropertyGridModelTester(question);
Expand Down

0 comments on commit 99de9cd

Please sign in to comment.