@@ -746,4 +746,78 @@ describe('Orchestrator', () => {
746746 surveyUnitCompositeName : 'RnJhbsOnYWlz' ,
747747 } )
748748 } )
749+
750+ it ( 'has proper label when expanding/collapsing layout' , async ( ) => {
751+ const user = userEvent . setup ( )
752+
753+ const sourceWithSequencePagination = {
754+ componentType : 'Questionnaire' ,
755+ components : [
756+ {
757+ componentType : 'Sequence' ,
758+ page : '1' ,
759+ id : 's1' ,
760+ label : [ { type : 'VTL' , value : '"Ma séquence"' } ] ,
761+ } ,
762+ {
763+ componentType : 'Question' ,
764+ page : '2' ,
765+ id : 'q1' ,
766+ components : [
767+ {
768+ componentType : 'Input' ,
769+ page : '2' ,
770+ label : { value : 'my-question' , type : 'TXT' } ,
771+ id : 'i1' ,
772+ response : { name : 'my-question-input' } ,
773+ } ,
774+ ] ,
775+ } ,
776+ {
777+ componentType : 'Question' ,
778+ page : '3' ,
779+ id : 'q2' ,
780+ components : [
781+ {
782+ componentType : 'Input' ,
783+ page : '3' ,
784+ label : { value : 'my-question-2' , type : 'TXT' } ,
785+ id : 'i2' ,
786+ response : { name : 'my-question-2-input' } ,
787+ } ,
788+ ] ,
789+ } ,
790+ ] ,
791+ variables : [ ] ,
792+ maxPage : '3' ,
793+ pagination : 'sequence' as const ,
794+ }
795+
796+ const interrogationWithLunaticPage = {
797+ ...defaultInterrogation ,
798+ stateData : {
799+ state : 'INIT' as QuestionnaireState ,
800+ date : 0 ,
801+ currentPage : '1' as PageType ,
802+ } ,
803+ }
804+
805+ const { getByText, getByRole } = renderWithRouter (
806+ < OrchestratorTestWrapper
807+ mode = { MODE_TYPE . COLLECT }
808+ source = { sourceWithSequencePagination }
809+ initialInterrogation = { interrogationWithLunaticPage }
810+ /> ,
811+ )
812+
813+ await user . click ( getByText ( 'Start' ) )
814+ const collapseButton = getByRole ( 'button' , { name : 'Collapse view' } )
815+ expect ( collapseButton ) . toBeInTheDocument ( )
816+ expect ( collapseButton ) . toHaveAttribute ( 'aria-pressed' , 'true' )
817+
818+ await user . click ( collapseButton )
819+ const expandButton = getByRole ( 'button' , { name : 'Expand view' } )
820+ expect ( expandButton ) . toBeInTheDocument ( )
821+ expect ( expandButton ) . toHaveAttribute ( 'aria-pressed' , 'false' )
822+ } )
749823} )
0 commit comments