Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov authored Oct 26, 2021
1 parent 6dcaac3 commit 6435e5f
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2582,7 +2582,7 @@ export function getItemValueWrapperComponentName(
item: ItemValue,
question: QuestionSelectBase
): string {
if (!!question["parentQuestionValue"] || question.isContentElement) {
if (question.isContentElement) {
return SurveyModel.TemplateRendererComponentName;
}
if (question.getType() === "imagepicker") {
Expand All @@ -2595,7 +2595,7 @@ export function getItemValueWrapperComponentData(
question: QuestionSelectBase,
creator: CreatorBase<SurveyModel>
): any {
if (!!question["parentQuestionValue"] || question.isContentElement) {
if (question.isContentElement) {
return item;
}
return {
Expand Down
99 changes: 98 additions & 1 deletion testCafe/designer/inplace-editors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getVisibleElement, url } from "../helper";
import { getVisibleElement, setJSON, url } from "../helper";
import { ClientFunction, Selector } from "testcafe";
const title = "Inplace editors";

Expand Down Expand Up @@ -162,6 +162,103 @@ test("Radiogroup question inplace editor", async (t) => {
.expect(items.nth(4).find("span").withText("Other (describe)").exists).ok();
});

test("Radiogroup inside PanelDynamic question inplace editor", async (t) => {
const json = {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "paneldynamic",
"name": "paneldynamic1",
"templateElements": [
{
"type": "radiogroup",
"name": "question1",
"choices": [
"item1",
"item2",
"item3"
]
}
]
}
]
}
]
};
await setJSON(json);

await t
.click(Selector("[name='question1']"))
.expect(items.count).eql(6)
.expect(items.nth(0).hasClass("svc-item-value--new")).notOk()
.expect(items.nth(0).find(".svc-item-value-controls__add").visible).notOk()
.expect(items.nth(0).find(".svc-item-value-controls__remove").visible).ok()
.expect(items.nth(0).find(".svc-item-value-controls__drag").visible).ok()
.expect(items.nth(0).find("span").withText("item1").exists).ok()
.expect(items.nth(1).hasClass("svc-item-value--new")).notOk()
.expect(items.nth(1).find(".svc-item-value-controls__add").visible).notOk()
.expect(items.nth(1).find(".svc-item-value-controls__remove").visible).ok()
.expect(items.nth(1).find(".svc-item-value-controls__drag").visible).ok()
.expect(items.nth(1).find("span").withText("item2").exists).ok()
.expect(items.nth(2).hasClass("svc-item-value--new")).notOk()
.expect(items.nth(2).find(".svc-item-value-controls__add").visible).notOk()
.expect(items.nth(2).find(".svc-item-value-controls__remove").visible).ok()
.expect(items.nth(2).find(".svc-item-value-controls__drag").visible).ok()
.expect(items.nth(2).find("span").withText("item3").exists).ok()
.expect(items.nth(3).hasClass("svc-item-value--new")).ok()
.expect(items.nth(3).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(3).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(3).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(3).find("span").withText("item4").exists).ok()
.expect(items.nth(4).hasClass("svc-item-value--new")).ok()
.expect(items.nth(4).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(4).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(4).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(4).find("span").withText("Other (describe)").exists).ok()
.expect(items.nth(5).hasClass("svc-item-value--new")).ok()
.expect(items.nth(5).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(5).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(5).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(5).find("span").withText("None").exists).ok()

.click(items.nth(5).find(".svc-item-value-controls__add"))
.expect(items.nth(5).hasClass("svc-item-value--new")).notOk()
.expect(items.nth(5).find(".svc-item-value-controls__add").visible).notOk()
.expect(items.nth(5).find(".svc-item-value-controls__remove").visible).ok()
.expect(items.nth(5).find(".svc-item-value-controls__drag").visible).notOk()

.click(items.nth(5).find(".svc-item-value-controls__remove"))
.expect(items.nth(5).hasClass("svc-item-value--new")).ok()
.expect(items.nth(5).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(5).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(5).find(".svc-item-value-controls__drag").visible).notOk()

.click(items.nth(3).find(".svc-item-value-controls__add"))
.expect(items.count).eql(7)
.expect(items.nth(3).hasClass("svc-item-value--new")).notOk()
.expect(items.nth(3).find(".svc-item-value-controls__add").visible).notOk()
.expect(items.nth(3).find(".svc-item-value-controls__remove").visible).ok()
.expect(items.nth(3).find(".svc-item-value-controls__drag").visible).ok()
.expect(items.nth(4).hasClass("svc-item-value--new")).ok()
.expect(items.nth(4).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(4).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(4).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(4).find("span").withText("item5").exists).ok()

.click(items.nth(3).find(".svc-item-value-controls__remove"))
.expect(items.count).eql(6)
.expect(items.nth(3).hasClass("svc-item-value--new")).ok()
.expect(items.nth(3).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(3).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(3).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(4).find(".svc-item-value-controls__add").visible).ok()
.expect(items.nth(4).find(".svc-item-value-controls__remove").visible).notOk()
.expect(items.nth(4).find(".svc-item-value-controls__drag").visible).notOk()
.expect(items.nth(4).find("span").withText("Other (describe)").exists).ok();
});

test("Dropdown question inplace editor", async (t) => {
await t
.expect(getVisibleElement(".svc-question__content").exists).notOk()
Expand Down

0 comments on commit 6435e5f

Please sign in to comment.