@@ -928,6 +928,46 @@ describe('PoWidgetComponent with title and actions', () => {
928928 expect ( footer ) . toBeFalsy ( ) ;
929929 } ) ;
930930
931+ it ( 'should add `po-widget-header--tag-top-actions` class when tagLabel, tagPosition is top and actions exist' , ( ) => {
932+ component . tagLabel = 'Sales' ;
933+ fixture . componentRef . setInput ( 'p-tag-position' , 'top' ) ;
934+ component . actions = [ { label : 'Test' } ] ;
935+
936+ fixture . detectChanges ( ) ;
937+
938+ expect ( nativeElement . querySelector ( '.po-widget-header--tag-top-actions' ) ) . toBeTruthy ( ) ;
939+ } ) ;
940+
941+ it ( 'should not add `po-widget-header--tag-top-actions` class when tagPosition is not top' , ( ) => {
942+ component . tagLabel = 'Sales' ;
943+ fixture . componentRef . setInput ( 'p-tag-position' , 'right' ) ;
944+ component . actions = [ { label : 'Test' } ] ;
945+
946+ fixture . detectChanges ( ) ;
947+
948+ expect ( nativeElement . querySelector ( '.po-widget-header--tag-top-actions' ) ) . toBeFalsy ( ) ;
949+ } ) ;
950+
951+ it ( 'should not add `po-widget-header--tag-top-actions` class when there are no actions' , ( ) => {
952+ component . tagLabel = 'Sales' ;
953+ fixture . componentRef . setInput ( 'p-tag-position' , 'top' ) ;
954+ component . actions = [ ] ;
955+
956+ fixture . detectChanges ( ) ;
957+
958+ expect ( nativeElement . querySelector ( '.po-widget-header--tag-top-actions' ) ) . toBeFalsy ( ) ;
959+ } ) ;
960+
961+ it ( 'should not add `po-widget-header--tag-top-actions` class when there is no tagLabel' , ( ) => {
962+ component . tagLabel = undefined ;
963+ fixture . componentRef . setInput ( 'p-tag-position' , 'top' ) ;
964+ component . actions = [ { label : 'Test' } ] ;
965+
966+ fixture . detectChanges ( ) ;
967+
968+ expect ( nativeElement . querySelector ( '.po-widget-header--tag-top-actions' ) ) . toBeFalsy ( ) ;
969+ } ) ;
970+
931971 it ( 'should find .po-widget-disabled if disabled is true' , ( ) => {
932972 component . disabled = true ;
933973
0 commit comments