-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug/7168 - Knockout: fromJSON breaks rendered survey - Question Title…
…s disappear (#7308) * Fixed #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear * Work for #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear * Work for #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear * Work for #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear - added tests for second case * Work for #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear - updated f-test * Work for #7168 - Knockout: fromJSON breaks rendered survey - Question Titles disappear - added unit test for empty pages case * Fix unit test #7168 --------- Co-authored-by: tsv2013 <tsv2013@noreply.github.com> Co-authored-by: Andrew Telnov <andrew.telnov@gmail.com>
- Loading branch information
1 parent
d102cea
commit 6bbc7d5
Showing
4 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { frameworks, url_test, initSurvey, applyTheme } from "../helper"; | ||
import { Selector, ClientFunction, fixture, test } from "testcafe"; | ||
const title = "Survey"; | ||
|
||
var json = { | ||
questionsOnPageMode: "questionPerPage", | ||
pages: [ | ||
{ | ||
name: "page1", | ||
elements: [ | ||
{ | ||
type: "radiogroup", | ||
name: "question1", | ||
choices: ["Item 1", "Item 2", "Item 3"] | ||
} | ||
] | ||
}, | ||
{ | ||
name: "page2", | ||
elements: [ | ||
{ | ||
type: "radiogroup", | ||
name: "question2", | ||
choices: ["Item 1", "Item 2", "Item 3"] | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
|
||
const themeName = "defaultV2"; | ||
|
||
frameworks.forEach((framework) => { | ||
fixture`${framework} ${title}` | ||
.page`${url_test}${themeName}/${framework}`.beforeEach(async (t) => { | ||
await applyTheme(themeName); | ||
await initSurvey(framework, json); | ||
await t.resizeWindow(1600, 900); | ||
}); | ||
test("Update survey via fromJSON", async (t) => { | ||
const updateSurvey = ClientFunction(() => { | ||
window.survey.data = { question1: "Item 1" }; | ||
var newJson = { | ||
pages: [ | ||
{ | ||
name: "page1", | ||
elements: [ | ||
{ | ||
type: "radiogroup", | ||
isRequired: true, | ||
name: "question1", | ||
choices: ["Item 1", "Item 2", "Item 3"] | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
window.survey.fromJSON(newJson); | ||
}); | ||
await t | ||
.expect(Selector("span").withText("question1").visible).ok(); | ||
await t | ||
.wait(500); | ||
await updateSurvey(); | ||
await t | ||
.wait(500); | ||
await updateSurvey(); | ||
await t | ||
.wait(500) | ||
.expect(Selector("span").withText("question1").visible).ok(); | ||
}); | ||
test("Change questionsOnPageMode", async (t) => { | ||
await t.expect(Selector("span").withText("question1").visible).ok(); | ||
await ClientFunction(() => { | ||
window.survey.questionsOnPageMode = "singlePage"; | ||
})(); | ||
await t.expect(Selector("span").withText("question1").visible).ok(); | ||
await ClientFunction(() => { | ||
window.survey.questionsOnPageMode = "questionPerPage"; | ||
})(); | ||
await t.expect(Selector("span").withText("question1").visible).ok(); | ||
await ClientFunction(() => { | ||
window.survey.questionsOnPageMode = "standard"; | ||
})(); | ||
await t.expect(Selector("span").withText("question1").visible).ok(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters