Skip to content

Commit

Permalink
Fixed surveyjs/survey-creator#4814 - HTML Question type unused proper…
Browse files Browse the repository at this point in the history
…ties are visible in creator
  • Loading branch information
tsv2013 committed Nov 8, 2023
1 parent 0380dca commit 76acd67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/question_html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ export class QuestionHtmlModel extends QuestionNonValue {
}
Serializer.addClass(
"html",
[{ name: "html:html", serializationProperty: "locHtml" }],
function() {
[
{ name: "html:html", serializationProperty: "locHtml" },
{ name: "hideNumber", visible: false },
{ name: "state", visible: false },
{ name: "titleLocation", visible: false },
{ name: "descriptionLocation", visible: false },
{ name: "errorLocation", visible: false },
{ name: "indent", visible: false },
{ name: "width", visible: false },
],
function () {
return new QuestionHtmlModel("");
},
"nonvalue"
Expand Down
4 changes: 2 additions & 2 deletions tests/jsonobjecttests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import {
JsonObject,
Serializer,
JsonUnknownPropertyError,
Expand Down Expand Up @@ -2961,7 +2961,7 @@ QUnit.test("Add defaultFunc attribute support, Bug#5615", function (assert) {
defaultValueForProp1 = 7;
assert.equal(obj.prop1, 7, "The default value is 7 now");
});
QUnit.test("", function (assert) {
QUnit.test("QuestionHtmlModel", function (assert) {
let html = new QuestionHtmlModel("q1");
assert.equal(html.renderAs, "default", "default is default");
Serializer.addProperty("html", { name: "renderAs", default: "auto", choices: ["auto", "standard", "image"] });
Expand Down
7 changes: 7 additions & 0 deletions tests/surveyquestiontests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7615,3 +7615,10 @@ QUnit.test("Test", function (assert) {
assert.deepEqual(survey.data, data2, "#2");
assert.equal(counter, 0, "#2");
});

QUnit.test("QuestionHtmlModel hide some properties", function (assert) {
let html = new QuestionHtmlModel("q1");
["hideNumber", "state", "titleLocation", "descriptionLocation", "errorLocation", "indent", "width"].forEach(property => {
assert.equal(Serializer.findProperty("html", property).visible, false, property + " should be hidden");
});
});

0 comments on commit 76acd67

Please sign in to comment.