@@ -1042,6 +1042,40 @@ test("Test string editor inplaceEditForValues without Creator", (): any => {
1042
1042
expect ( q0 . otherText ) . toEqual ( "Other changed" ) ;
1043
1043
} ) ;
1044
1044
1045
+ test ( "Test string editor description clear (with EOL)" , ( ) : any => {
1046
+ const survey = new SurveyModel ( {
1047
+ "pages" : [
1048
+ {
1049
+ "name" : "page1" ,
1050
+ "elements" : [
1051
+ {
1052
+ "type" : "radiogroup" ,
1053
+ "title" : "title" ,
1054
+ "description" : "desc" ,
1055
+ "name" : "q0" ,
1056
+ "choices" : [ "i1" , "i2" ]
1057
+ }
1058
+ ]
1059
+ }
1060
+ ]
1061
+ } ) ;
1062
+
1063
+ const q0 = survey . getQuestionByName ( "q0" ) ;
1064
+ const itemValue = q0 . choices [ 0 ] ;
1065
+ var seChoice = new StringEditorViewModelBase ( itemValue . locText ) ;
1066
+ var seDescription = new StringEditorViewModelBase ( q0 . locDescription ) ;
1067
+ expect ( itemValue . text ) . toEqual ( "i1" ) ;
1068
+ seChoice . onBlur ( { target : { innerText : "new\nTitle" , innerHTML : "new\nTitle" , setAttribute : ( ) => { } , removeAttribute : ( ) => { } } } ) ;
1069
+ expect ( itemValue . text ) . toEqual ( "newTitle" ) ;
1070
+
1071
+ expect ( q0 . description ) . toEqual ( "desc" ) ;
1072
+ seDescription . onBlur ( { target : { innerText : "new\nDesc" , innerHTML : "new\nDesc" , setAttribute : ( ) => { } , removeAttribute : ( ) => { } } } ) ;
1073
+ expect ( q0 . locDescription . text ) . toEqual ( "new\nDesc" ) ;
1074
+
1075
+ seDescription . onBlur ( { target : { innerText : "\n" , innerHTML : "\n" , setAttribute : ( ) => { } , removeAttribute : ( ) => { } } } ) ;
1076
+ expect ( q0 . locDescription . text ) . toEqual ( "" ) ;
1077
+ } ) ;
1078
+
1045
1079
test ( "StringEditor multiline paste for selectbase questions should respect creator.maximumChoicesCount" , ( ) : any => {
1046
1080
const creator = new CreatorTester ( ) ;
1047
1081
creator . maximumChoicesCount = 4 ;
0 commit comments