@@ -4,9 +4,9 @@ import { SurveyCreator } from "../src/editor";
4
4
import { PagesEditorViewModel } from "../src/components/pages-editor" ;
5
5
import { SurveyQuestionEditor } from "../src/questionEditors/questionEditor" ;
6
6
import { SurveyObjectProperty } from "../src/objectProperty" ;
7
- import { QuestionToolbox } from "../src/components/toolbox" ;
8
7
import { AccordionViewModel } from "../src/utils/accordion" ;
9
8
import { isPropertyVisible } from "../src/utils/utils" ;
9
+ import { SurveyPropertyConditionEditor } from "../src/propertyEditors/propertyConditionEditor" ;
10
10
11
11
export default QUnit . module ( "surveyEditorTests" ) ;
12
12
@@ -1599,3 +1599,30 @@ QUnit.test("generate element name based on another survey", function (assert) {
1599
1599
"Generate question10 name, next after question10"
1600
1600
) ;
1601
1601
} ) ;
1602
+ QUnit . test ( "creator.onConditionQuestionsGetList, Bug#957" , function ( assert ) {
1603
+ var creator = new SurveyCreator ( ) ;
1604
+ creator . onConditionQuestionsGetList . add ( function ( sender , options ) {
1605
+ options . list = options . list . filter (
1606
+ ( question ) => question . getType ( ) === "text"
1607
+ ) ;
1608
+ } ) ;
1609
+ creator . JSON = {
1610
+ elements : [
1611
+ { name : "q1" , type : "text" } ,
1612
+ { name : "q2" , type : "text" } ,
1613
+ { name : "q3" , type : "dropdown" } ,
1614
+ { name : "q4" , type : "checkbox" } ,
1615
+ { name : "q5" , type : "radiogroup" } ,
1616
+ ] ,
1617
+ } ;
1618
+ var question = creator . survey . getQuestionByName ( "q1" ) ;
1619
+ var property = Survey . Serializer . findProperty ( "question" , "visibleIf" ) ;
1620
+ var editor = new SurveyPropertyConditionEditor ( property ) ;
1621
+ editor . options = creator ;
1622
+ editor . object = question ;
1623
+ editor . beforeShow ( ) ;
1624
+ editor . isEditorShowing = true ;
1625
+ var editorItem = editor . koEditorItems ( ) [ 0 ] ;
1626
+ assert . ok ( editorItem , "Editor item is created" ) ;
1627
+ assert . equal ( editorItem . nameQuestion . choices . length , 1 , "One text question" ) ;
1628
+ } ) ;
0 commit comments