Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Text question placeholder disappears when switching from Preview to… #7913

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ export class SurveyModel extends SurveyElementCore
}
);
this.registerPropertyChangedHandlers(
["isLoading", "isCompleted", "isCompletedBefore", "mode", "isStartedState", "currentPage"],
["isLoading", "isCompleted", "isCompletedBefore", "mode", "isStartedState", "currentPage", "isShowingPreview"],
() => { this.updateState(); });
this.registerPropertyChangedHandlers(["state", "currentPage", "showPreviewBeforeComplete"],
() => { this.onStateAndCurrentPageChanged(); });
Expand Down
18 changes: 18 additions & 0 deletions tests/question_texttests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ QUnit.test("Test renderedPlaceholder on locale change", function(assert) {
assert.equal(q2.renderedPlaceholder, "comment_de", "text, locale de");
survey.locale = "";
});
QUnit.test("Test renderedPlaceholder on locale change, bug#7911", function(assert) {
const survey = new SurveyModel({
elements: [
{
name: "q1",
type: "text",
placeholder: "my text"
}
]
});
survey.showPreview();
let q1 = <QuestionTextModel>survey.getQuestionByName("q1");
assert.notOk(q1.renderedPlaceholder, "#1");
survey.cancelPreview();
q1 = <QuestionTextModel>survey.getQuestionByName("q1");
assert.equal(q1.renderedPlaceholder, "my text", "#2");
});
QUnit.test("Test renderedPlaceholder on locale change", function(assert) {
const survey = new SurveyModel({
"elements": [
Expand All @@ -102,6 +119,7 @@ QUnit.test("Test renderedPlaceholder on locale change", function(assert) {
const q1 = <QuestionTextModel>survey.getAllQuestions()[0];
assert.equal(q1.renderedPlaceholder, "Spanish", "text, locale es");
});

QUnit.test("min date error text, bug #4596", function(assert) {
const survey = new SurveyModel({
elements: [{ type: "text", name: "q1", inputType: "date", min: "2000-10-10" }]
Expand Down
Loading