@@ -476,6 +476,57 @@ QUnit.test("matrix eachRowRequired & getItemClass", function (assert) {
476
476
assert . equal ( question . getItemClass ( row , column1 ) . indexOf ( itemError ) > - 1 , false , "itemError doesn't exist in column 1, #1" ) ;
477
477
assert . equal ( question . getItemClass ( row , column2 ) . indexOf ( itemError ) > - 1 , false , "itemError doesn't exist in column 2, #1" ) ;
478
478
} ) ;
479
+ QUnit . test ( "matrix eachRowRequired & row visibleIf, Bug#10395.1" , function ( assert ) {
480
+ const survey = new SurveyModel ( {
481
+ elements : [
482
+ {
483
+ type : "matrix" ,
484
+ name : "q1" ,
485
+ columns : [ "col1" ] ,
486
+ rows : [ "row1" , { value : "row2" , visibleIf : "false" } ] ,
487
+ eachRowRequired : true
488
+ } ,
489
+ ]
490
+ } ) ;
491
+ const question = < QuestionMatrixModel > survey . getQuestionByName ( "q1" ) ;
492
+ assert . equal ( question . visibleRows . length , 1 , "There is one visible row" ) ;
493
+ question . visibleRows [ 0 ] . value = "col1" ;
494
+ assert . equal ( question . validate ( ) , true , "There is no errors" ) ;
495
+ } ) ;
496
+ QUnit . test ( "matrix eachRowRequired & row visibleIf, Bug#10395.2" , function ( assert ) {
497
+ const survey = new SurveyModel ( {
498
+ elements : [
499
+ {
500
+ type : "matrixdropdown" ,
501
+ name : "q1" ,
502
+ columns : [ { name : "col1" , cellType : "text" } ] ,
503
+ rows : [ "row1" , { value : "row2" , visibleIf : "false" } ] ,
504
+ eachRowRequired : true
505
+ } ,
506
+ ]
507
+ } ) ;
508
+ const question = < QuestionMatrixModel > survey . getQuestionByName ( "q1" ) ;
509
+ assert . equal ( question . visibleRows . length , 1 , "There is one visible row" ) ;
510
+ question . visibleRows [ 0 ] . value = "col1" ;
511
+ assert . equal ( question . validate ( ) , true , "There is no errors" ) ;
512
+ } ) ;
513
+ QUnit . test ( "matrix eachRowRequired & row visibleIf, Bug#10395.2" , function ( assert ) {
514
+ const survey = new SurveyModel ( {
515
+ elements : [
516
+ {
517
+ type : "matrixdropdown" ,
518
+ name : "q1" ,
519
+ columns : [ { name : "col1" , cellType : "text" , isUnique : true } ] ,
520
+ rows : [ "row1" , { value : "row2" , visibleIf : "false" } ] ,
521
+ eachRowRequired : true
522
+ } ,
523
+ ]
524
+ } ) ;
525
+ const question = < QuestionMatrixModel > survey . getQuestionByName ( "q1" ) ;
526
+ question . value = { row1 : "val1" , row2 : "val1" } ;
527
+ assert . equal ( question . visibleRows . length , 1 , "There is one visible row" ) ;
528
+ assert . equal ( question . validate ( ) , true , "There is no errors" ) ;
529
+ } ) ;
479
530
QUnit . test ( "hideIfRowsEmpty & question visibleIf, bug#8459" , function ( assert ) {
480
531
const survey = new SurveyModel ( {
481
532
elements : [ { type : "matrix" , name : "q1" , visibleIf : "{a}=1" , hideIfRowsEmpty : true , rows : [ { value : "row1" , visibleIf : "{b}=2" } ] } ] ,
0 commit comments