@@ -570,6 +570,130 @@ describe("Items selection", () => {
570570 . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
571571 . ui5ResponsivePopoverOpened ( ) ;
572572 } ) ;
573+
574+ it ( "Should disable the toggle button when there are no selected items" , ( ) => {
575+ cy . mount (
576+ < MultiComboBox >
577+ < MultiComboBoxItem text = "Cosy" > </ MultiComboBoxItem >
578+ < MultiComboBoxItem text = "Compact" > </ MultiComboBoxItem >
579+ </ MultiComboBox >
580+ ) ;
581+
582+ cy . get ( "[ui5-multi-combobox]" )
583+ . realClick ( ) ;
584+
585+ cy . get ( "[ui5-multi-combobox]" )
586+ . shadow ( )
587+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
588+ . as ( "respPopover" )
589+ . ui5ResponsivePopoverOpened ( ) ;
590+
591+ cy . get ( "@respPopover" )
592+ . find ( "[ui5-toggle-button]" )
593+ . should ( "have.attr" , "disabled" ) ;
594+ } ) ;
595+
596+ it ( "Should enable the toggle button when there is selected item" , ( ) => {
597+ cy . mount (
598+ < MultiComboBox >
599+ < MultiComboBoxItem text = "Cosy" selected > </ MultiComboBoxItem >
600+ < MultiComboBoxItem text = "Compact" > </ MultiComboBoxItem >
601+ </ MultiComboBox >
602+ ) ;
603+
604+ cy . get ( "[ui5-multi-combobox]" )
605+ . realClick ( ) ;
606+
607+ cy . get ( "[ui5-multi-combobox]" )
608+ . shadow ( )
609+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
610+ . as ( "respPopover" )
611+ . ui5ResponsivePopoverOpened ( ) ;
612+
613+ cy . get ( "@respPopover" )
614+ . find ( "[ui5-toggle-button]" )
615+ . should ( "not.have.attr" , "disabled" ) ;
616+ } ) ;
617+
618+ it ( "Should show only selected items on n-more click and toggle the button" , ( ) => {
619+ cy . mount (
620+ < MultiComboBox placeholder = "Select options" >
621+ < MultiComboBoxItem text = "Item 1" selected />
622+ < MultiComboBoxItem text = "Item 2" selected />
623+ < MultiComboBoxItem text = "Item 3" />
624+ < MultiComboBoxItem text = "Item 4" selected />
625+ </ MultiComboBox >
626+ ) ;
627+
628+ cy . get ( "[ui5-multi-combobox]" )
629+ . shadow ( )
630+ . find ( "[ui5-tokenizer]" )
631+ . shadow ( )
632+ . find ( ".ui5-tokenizer-more-text" )
633+ . realClick ( ) ;
634+
635+ cy . get ( "[ui5-multi-combobox]" )
636+ . shadow ( )
637+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
638+ . as ( "respPopover" )
639+ . ui5ResponsivePopoverOpened ( ) ;
640+
641+ cy . get ( "@respPopover" )
642+ . find ( "[ui5-toggle-button]" )
643+ . should ( "have.attr" , "pressed" ) ;
644+
645+ cy . get ( "@respPopover" )
646+ . find ( "[ui5-list]" )
647+ . find ( "slot" )
648+ . should ( "have.length" , 3 ) ;
649+ } ) ;
650+
651+ it ( "Shows all items matching 'I' after clicking N-more and typing in the popover input" , ( ) => {
652+ cy . mount (
653+ < MultiComboBox placeholder = "Select options" >
654+ < MultiComboBoxItem text = "Item 1" selected />
655+ < MultiComboBoxItem text = "Item 2" />
656+ < MultiComboBoxItem text = "Item 3" />
657+ < MultiComboBoxItem text = "Item 4" selected />
658+ </ MultiComboBox >
659+ ) ;
660+
661+ cy . get ( "[ui5-multi-combobox]" )
662+ . shadow ( )
663+ . find ( "[ui5-tokenizer]" )
664+ . shadow ( )
665+ . find ( ".ui5-tokenizer-more-text" )
666+ . realClick ( ) ;
667+
668+ cy . get ( "[ui5-multi-combobox]" )
669+ . shadow ( )
670+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
671+ . as ( "respPopover" )
672+ . ui5ResponsivePopoverOpened ( ) ;
673+
674+ cy . get ( "@respPopover" )
675+ . find ( "[ui5-toggle-button]" )
676+ . should ( "have.attr" , "pressed" ) ;
677+
678+ cy . get ( "@respPopover" )
679+ . find ( "[ui5-list]" )
680+ . find ( "slot" )
681+ . should ( "have.length" , 2 ) ;
682+
683+ cy . get ( "@respPopover" )
684+ . find ( "[ui5-input]" )
685+ . realClick ( )
686+ . realType ( "I" ) ;
687+
688+ cy . get ( "@respPopover" )
689+ . find ( "[ui5-toggle-button]" )
690+ . should ( "not.have.attr" , "pressed" ) ;
691+
692+ cy . get ( "@respPopover" )
693+ . find ( "[ui5-list]" )
694+ . find ( "slot" )
695+ . should ( "have.length" , 4 ) ;
696+ } ) ;
573697} ) ;
574698
575699describe ( "Value state header" , ( ) => {
0 commit comments