@@ -33,6 +33,7 @@ import { RemoteData } from '../core/data/remote-data';
3333import {
3434 BrowseSection ,
3535 FacetSection ,
36+ MultiColumnTopSection ,
3637 SearchSection ,
3738 Section ,
3839 TopSection ,
@@ -41,6 +42,7 @@ import {
4142import { ThemedBrowseSectionComponent } from '../shared/explore/section-component/browse-section/themed-browse-section.component' ;
4243import { ThemedCountersSectionComponent } from '../shared/explore/section-component/counters-section/themed-counters-section.component' ;
4344import { ThemedFacetSectionComponent } from '../shared/explore/section-component/facet-section/themed-facet-section.component' ;
45+ import { ThemedMultiColumnTopSectionComponent } from '../shared/explore/section-component/multi-column-top-section/themed-multi-column-top-section.component' ;
4446import { ThemedSearchSectionComponent } from '../shared/explore/section-component/search-section/themed-search-section.component' ;
4547import { ThemedTextSectionComponent } from '../shared/explore/section-component/text-section/themed-text-section.component' ;
4648import { ThemedTopSectionComponent } from '../shared/explore/section-component/top-section/themed-top-section.component' ;
@@ -87,14 +89,24 @@ describe('ExploreComponent', () => {
8789 facetsPerRow : 4 ,
8890 } ;
8991
92+ const multiColumnTopComponent : MultiColumnTopSection = {
93+ discoveryConfigurationName : 'publication' ,
94+ componentType : 'multi-column-top' ,
95+ style : 'col-md-12' ,
96+ order : 'desc' ,
97+ sortField : 'dc.date.accessioned' ,
98+ titleKey : 'lastPublications' ,
99+ columnList : [ ] ,
100+ } ;
101+
90102 beforeEach ( waitForAsync ( ( ) => {
91103
92104 sectionDataServiceStub = {
93105 findById ( id : string ) : Observable < RemoteData < Section > > {
94106 if ( id === 'publications' ) {
95107 const section = new Section ( ) ;
96108 section . id = 'publications' ;
97- section . componentRows = [ [ browseComponent , searchComponent ] , [ topComponent ] , [ facetComponent ] ] ;
109+ section . componentRows = [ [ browseComponent , searchComponent ] , [ topComponent ] , [ facetComponent ] , [ multiColumnTopComponent ] ] ;
98110 return createSuccessfulRemoteDataObject$ ( section ) ;
99111 } else {
100112 return of ( null ) ;
@@ -119,7 +131,7 @@ describe('ExploreComponent', () => {
119131 { provide : SectionDataService , useValue : sectionDataServiceStub } ,
120132 { provide : ActivatedRoute , useValue : route } ] ,
121133 schemas : [ NO_ERRORS_SCHEMA ] ,
122- } ) . overrideComponent ( ExplorePageComponent , { remove : { imports : [ ThemedTopSectionComponent , ThemedBrowseSectionComponent , ThemedSearchSectionComponent , ThemedFacetSectionComponent , ThemedTextSectionComponent , ThemedCountersSectionComponent ] } } ) . compileComponents ( ) ;
134+ } ) . overrideComponent ( ExplorePageComponent , { remove : { imports : [ ThemedTopSectionComponent , ThemedMultiColumnTopSectionComponent , ThemedBrowseSectionComponent , ThemedSearchSectionComponent , ThemedFacetSectionComponent , ThemedTextSectionComponent , ThemedCountersSectionComponent ] } } ) . compileComponents ( ) ;
123135
124136 } ) ) ;
125137
@@ -133,9 +145,9 @@ describe('ExploreComponent', () => {
133145 expect ( comp ) . toBeDefined ( ) ;
134146 } ) ) ;
135147
136- it ( 'should place the sections on three rows' , ( ) => {
148+ it ( 'should place the sections on four rows' , ( ) => {
137149 const container = fixture . debugElement . query ( By . css ( '.container' ) ) ;
138- expect ( container . children . length ) . toEqual ( 3 ) ;
150+ expect ( container . children . length ) . toEqual ( 4 ) ;
139151
140152 const firstRow = container . children [ 0 ] ;
141153 expect ( firstRow . children . length ) . toEqual ( 2 ) ;
@@ -150,6 +162,10 @@ describe('ExploreComponent', () => {
150162 expect ( thirdRow . children . length ) . toEqual ( 1 ) ;
151163 expect ( thirdRow . children [ 0 ] . children [ 0 ] . name ) . toEqual ( 'ds-facet-section' ) ;
152164
165+ const fourthRow = container . children [ 3 ] ;
166+ expect ( fourthRow . children . length ) . toEqual ( 1 ) ;
167+ expect ( fourthRow . children [ 0 ] . children [ 0 ] . name ) . toEqual ( 'ds-multi-column-top-section' ) ;
168+
153169 expect ( component . sectionId ) . toEqual ( 'publications' ) ;
154170 } ) ;
155171
0 commit comments