@@ -938,6 +938,56 @@ describe('Grid directives', () => {
938938 expect ( widgetElement . getAttribute ( 'tabindex' ) ) . toBe ( '-1' ) ;
939939 } ) ;
940940
941+ it ( 'should emit the activated output on Enter for simple widget' , ( ) => {
942+ const gridData = createGridData ( ) ;
943+ gridData [ 0 ] . cells [ 0 ] . widgets = [ { id : 'w1' , type : 'simple' } ] ;
944+ setupGrid ( { gridData} ) ;
945+ gridInstance . _pattern . setDefaultStateEffect ( ) ;
946+ fixture . detectChanges ( ) ;
947+
948+ tabIntoGrid ( ) ;
949+
950+ expect ( fixture . componentInstance . onActivated ) . not . toHaveBeenCalled ( ) ;
951+
952+ keydown ( 'Enter' ) ;
953+ expect ( fixture . componentInstance . onActivated ) . toHaveBeenCalled ( ) ;
954+ } ) ;
955+
956+ it ( 'should emit the activated output on Space for simple widget' , ( ) => {
957+ const gridData = createGridData ( ) ;
958+ gridData [ 0 ] . cells [ 0 ] . widgets = [ { id : 'w1' , type : 'simple' } ] ;
959+ setupGrid ( { gridData} ) ;
960+ gridInstance . _pattern . setDefaultStateEffect ( ) ;
961+ fixture . detectChanges ( ) ;
962+
963+ tabIntoGrid ( ) ;
964+
965+ expect ( fixture . componentInstance . onActivated ) . not . toHaveBeenCalled ( ) ;
966+
967+ keydown ( ' ' ) ;
968+ expect ( fixture . componentInstance . onActivated ) . toHaveBeenCalled ( ) ;
969+ } ) ;
970+
971+ it ( 'should emit the activated output in activedescendant mode when event is dispatched directly to grid' , ( ) => {
972+ const gridData = createGridData ( ) ;
973+ gridData [ 0 ] . cells [ 0 ] . widgets = [ { id : 'w1' , type : 'simple' } ] ;
974+ setupGrid ( { gridData, focusMode : 'activedescendant' } ) ;
975+ gridInstance . _pattern . setDefaultStateEffect ( ) ;
976+ fixture . detectChanges ( ) ;
977+
978+ expect ( fixture . componentInstance . onActivated ) . not . toHaveBeenCalled ( ) ;
979+
980+ // Verify standard activedescendant behavior by targeting the CONTAINER directly
981+ const event = new KeyboardEvent ( 'keydown' , {
982+ key : 'Enter' ,
983+ bubbles : true ,
984+ } ) ;
985+ gridElement . dispatchEvent ( event ) ;
986+ fixture . detectChanges ( ) ;
987+
988+ expect ( fixture . componentInstance . onActivated ) . toHaveBeenCalled ( ) ;
989+ } ) ;
990+
941991 it ( 'should emit the activated output when the widget becomes active' , ( ) => {
942992 const gridData = createGridData ( ) ;
943993 gridData [ 0 ] . cells [ 0 ] . widgets = [ { id : 'w1' , type : 'complex' } ] ;
0 commit comments