Skip to content

Commit

Permalink
Fixed #5578 - The creator.onModified event is not raised when modifyi…
Browse files Browse the repository at this point in the history
…ng individual Mask Settings (#5596)

Co-authored-by: tsv2013 <[email protected]>
  • Loading branch information
tsv2013 and tsv2013 authored Jun 19, 2024
1 parent 9d98676 commit ddb5621
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion packages/survey-creator-core/tests/creator-base.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4325,4 +4325,32 @@ test("Check the placeholders of the survey items if isMobileView is true", (): a
expect(pageModelAdorner.placeholderText).toBe("Click the \"Add Question\" button below to add a new element to the page.");
expect(panelModelAdorner.placeholderText).toBe("Click the \"Add Question\" button below to add a new element to the panel.");
expect(imageQuestionModelAdorner.placeholderText).toBe("Click the button below and choose an image to upload");
});
});

test("onModified is raised for mask settings", (): any => {
const creator = new CreatorTester();
creator.JSON = {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "text",
"name": "question1",
"maskType": "numeric",
"maskSettings": {
"thousandsSeparator": "."
}
}
]
}
]
};
let propName = "not triggered";
creator.onModified.add((sender, options) => {
propName = options.name;
});
const maskedQuestion = creator.survey.getQuestionByName("question1") as QuestionTextModel;
(maskedQuestion.maskSettings as any).thousandsSeparator = "-";
expect(propName).toBe("thousandsSeparator");
});

0 comments on commit ddb5621

Please sign in to comment.