-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rating question used inside a Custom Component - The displayMode: aut… (
#6932) * Rating question used inside a Custom Component - The displayMode: auto doesn't work and rate options overflow the question area fix #6915 * Fix functional test#6915 * Remove waiting from functional test #6915
- Loading branch information
1 parent
a79847a
commit c440fad
Showing
3 changed files
with
68 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
<script type="text/html" id="survey-question-custom"> | ||
<!-- ko template: { name: question.contentQuestion.koTemplateName(), data: question.contentQuestion, as: 'question', afterRender: question.contentQuestion.koQuestionAfterRender } --> | ||
<!-- /ko --> | ||
<!-- ko if: question.contentQuestion.isDefaultRendering() --> | ||
<!-- ko template: { name: question.contentQuestion.koTemplateName(), data: question.contentQuestion, as: 'question', afterRender: question.contentQuestion.koQuestionAfterRender } --> | ||
<!-- /ko --> | ||
<!-- /ko --> | ||
<!-- ko ifnot: question.contentQuestion.isDefaultRendering() --> | ||
<!-- ko component: { name: question.contentQuestion.getComponentName(), params: { question: question.contentQuestion } } --> | ||
<!-- /ko --> | ||
<!-- /ko --> | ||
</script> |
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,54 @@ | ||
import { url_test, initSurvey, getSurveyResult, frameworks, explicitErrorHandler } from "../helper"; | ||
import { Selector, ClientFunction } from "testcafe"; | ||
const title = "Custom Components"; | ||
const themeName = "defaultV2"; | ||
const json = { | ||
"elements": [ | ||
{ | ||
type: "nps", | ||
name: "q1" | ||
} | ||
] | ||
}; | ||
|
||
const registerNPSComponet = ClientFunction(() => { | ||
window["Survey"].ComponentCollection.Instance.add({ | ||
//Unique component name. It becomes a new question type. Please note, it should be written in lowercase. | ||
name: "nps", //The text that shows on toolbox | ||
title: "NPS Rating", //The actual question that will do the job | ||
questionJSON: { | ||
type: "rating", | ||
rateValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
minRateDescription: "Very unlikely", | ||
maxRateDescription: "Very likely", | ||
displayMode: "auto" | ||
} | ||
}); | ||
}); | ||
|
||
frameworks.forEach(framework => { | ||
fixture`${framework} ${title}`.page`${url_test}${themeName}/${framework}`.beforeEach( | ||
async t => { | ||
} | ||
); | ||
test("Show rating in component as dropdown", async t => { | ||
const questionDropdownSelect = Selector(".sd-input.sd-dropdown"); | ||
await explicitErrorHandler(); | ||
await t.resizeWindow(500, 600); | ||
await registerNPSComponet(); | ||
await initSurvey(framework, json); | ||
|
||
await t | ||
.click(questionDropdownSelect) | ||
.pressKey("down") | ||
.pressKey("down") | ||
.pressKey("down") | ||
.pressKey("down") | ||
.pressKey("enter"); | ||
|
||
await t.click(Selector("input[value='Complete']")); | ||
|
||
const surveyResult = await getSurveyResult(); | ||
await t.expect(surveyResult.q1).eql(3); | ||
}); | ||
}); |