@@ -368,7 +368,15 @@ Vue.component('layout-spec', {
368368 this . bus . $emit ( 'spec-clicked' , this . spec , this . layout ) ;
369369 }
370370 }
371- } )
371+ } ) ;
372+
373+ Vue . component ( 'layout-spec-group' , {
374+ props : [ 'layout' , 'specgroup' , 'bus' ] ,
375+ template : '#tpl-spec-group' ,
376+ methods : {
377+ toggleReportNode : toggleReportNode
378+ }
379+ } ) ;
372380
373381Vue . component ( 'layout-report' , {
374382 props : [ 'layout' ] ,
@@ -656,18 +664,31 @@ function enrichObjectAndReturnHasFailure(object) {
656664 object . expanded = false ;
657665 object . hasFailure = false ;
658666
659- _ . forEach ( object . specs , function ( spec ) {
660- if ( spec . errors && spec . errors . length > 0 ) {
661- object . hasFailure = true ;
662- }
663- if ( spec . subLayout && spec . subLayout . sections ) {
664- _ . forEach ( spec . subLayout . sections , function ( subSection ) {
665- if ( enrichSectionAndReturnHasFailure ( subSection ) ) {
666- object . hasFailure = true ;
667- }
668- } ) ;
669- }
670- } ) ;
667+ var enrichSpec = function ( parent ) {
668+ return function ( spec ) {
669+ if ( spec . errors && spec . errors . length > 0 ) {
670+ parent . hasFailure = true ;
671+ }
672+ if ( spec . subLayout && spec . subLayout . sections ) {
673+ _ . forEach ( spec . subLayout . sections , function ( subSection ) {
674+ if ( enrichSectionAndReturnHasFailure ( subSection ) ) {
675+ parent . hasFailure = true ;
676+ }
677+ } ) ;
678+ }
679+ } ;
680+ } ;
681+
682+ _ . forEach ( object . specs , enrichSpec ( object ) ) ;
683+ if ( object . specGroups ) {
684+ _ . forEach ( object . specGroups , function ( specGroup ) {
685+ specGroup . expanded = false ;
686+ _ . forEach ( specGroup . specs , enrichSpec ( specGroup ) ) ;
687+ if ( specGroup . hasFailure ) {
688+ object . hasFailure = true ;
689+ }
690+ } ) ;
691+ }
671692 return object . hasFailure ;
672693}
673694
@@ -733,6 +754,14 @@ function expandOnlyErrorsInSection (section) {
733754 }
734755 } ) ;
735756 }
757+ _ . forEach ( object . specGroups , function ( specGroup ) {
758+ specGroup . expanded = specGroup . hasFailure ;
759+ _ . forEach ( specGroup . specs , function ( spec ) {
760+ if ( spec . subLayout && spec . subLayout . sections ) {
761+ _ . forEach ( spec . subLayout . sections , expandOnlyErrorsInSection ) ;
762+ }
763+ } ) ;
764+ } ) ;
736765 } ) ;
737766}
738767
@@ -758,6 +787,17 @@ function visitEachSection(section, callback) {
758787 } ) ;
759788 _ . forEach ( section . objects , function ( object ) {
760789 callback ( object , 'object' ) ;
790+
791+ _ . forEach ( object . specs , function ( spec ) {
792+ if ( spec . subLayout ) {
793+ _ . forEach ( spec . subLayout . sections , function ( subSection ) {
794+ visitEachSection ( subSection , callback ) ;
795+ } ) ;
796+ }
797+ } ) ;
798+ _ . forEach ( object . specGroups , function ( specGroup ) {
799+ callback ( specGroup ) ;
800+ } ) ;
761801 } ) ;
762802}
763803
0 commit comments