@@ -16,6 +16,7 @@ import { of as observableOf } from 'rxjs';
1616import { By } from '@angular/platform-browser' ;
1717import { isEmpty , isNotEmpty } from '../../shared/empty.util' ;
1818import { FlatNode } from '../flat-node.model' ;
19+ import { RouterLinkWithHref } from '@angular/router' ;
1920
2021describe ( 'CommunityListComponent' , ( ) => {
2122 let component : CommunityListComponent ;
@@ -194,7 +195,7 @@ describe('CommunityListComponent', () => {
194195 } ) ,
195196 CdkTreeModule ,
196197 RouterTestingModule ] ,
197- declarations : [ CommunityListComponent ] ,
198+ declarations : [ CommunityListComponent , RouterLinkWithHref ] ,
198199 providers : [ CommunityListComponent ,
199200 { provide : CommunityListService , useValue : communityListServiceStub } , ] ,
200201 schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
@@ -230,16 +231,22 @@ describe('CommunityListComponent', () => {
230231 expect ( showMoreEl ) . toBeTruthy ( ) ;
231232 } ) ;
232233
234+ it ( 'should not render the show more button as an empty link' , ( ) => {
235+ const debugElements = fixture . debugElement . queryAll ( By . directive ( RouterLinkWithHref ) ) ;
236+ expect ( debugElements ) . toBeTruthy ( ) ;
237+ } ) ;
238+
233239 describe ( 'when show more of top communities is clicked' , ( ) => {
234240 beforeEach ( fakeAsync ( ( ) => {
235- const showMoreLink = fixture . debugElement . query ( By . css ( '.show-more-node a ' ) ) ;
241+ const showMoreLink = fixture . debugElement . query ( By . css ( '.show-more-node .btn-outline-primary ' ) ) ;
236242 showMoreLink . triggerEventHandler ( 'click' , {
237243 preventDefault : ( ) => { /**/
238244 }
239245 } ) ;
240246 tick ( ) ;
241247 fixture . detectChanges ( ) ;
242248 } ) ) ;
249+
243250 it ( 'tree contains maximum of currentPage (2) * (2) elementsPerPage of first top communities, or less if there are less communities (3)' , ( ) => {
244251 const expandableNodesFound = fixture . debugElement . queryAll ( By . css ( '.expandable-node a' ) ) ;
245252 const childlessNodesFound = fixture . debugElement . queryAll ( By . css ( '.childless-node a' ) ) ;
0 commit comments