File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed
library-authoring/components Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const CollectionHitSample: CollectionHit = {
17
17
} ,
18
18
created : 1722434322294 ,
19
19
modified : 1722434322294 ,
20
+ numChildren : 2 ,
20
21
tags : { } ,
21
22
} ;
22
23
@@ -32,7 +33,8 @@ describe('<CollectionCard />', () => {
32
33
it ( 'should render the card with title and description' , ( ) => {
33
34
render ( < CollectionCard collectionHit = { CollectionHitSample } /> ) ;
34
35
35
- expect ( screen . getByText ( 'Collection Display Formated Name' ) ) . toBeInTheDocument ( ) ;
36
- expect ( screen . getByText ( 'Collection description' ) ) . toBeInTheDocument ( ) ;
36
+ expect ( screen . queryByText ( 'Collection Display Formated Name' ) ) . toBeInTheDocument ( ) ;
37
+ expect ( screen . queryByText ( 'Collection description' ) ) . toBeInTheDocument ( ) ;
38
+ expect ( screen . queryByText ( 'Collection (2)' ) ) . toBeInTheDocument ( ) ;
37
39
} ) ;
38
40
} ) ;
Original file line number Diff line number Diff line change @@ -21,8 +21,13 @@ const CollectionCard = ({ collectionHit } : CollectionCardProps) => {
21
21
type,
22
22
formatted,
23
23
tags,
24
+ numChildren,
24
25
} = collectionHit ;
25
26
const { displayName = '' , description = '' } = formatted ;
27
+ const blockTypeDisplayName = numChildren ? intl . formatMessage (
28
+ messages . collectionTypeWithCount ,
29
+ { numChildren } ,
30
+ ) : intl . formatMessage ( messages . collectionType ) ;
26
31
27
32
return (
28
33
< BaseComponentCard
@@ -40,7 +45,7 @@ const CollectionCard = ({ collectionHit } : CollectionCardProps) => {
40
45
/>
41
46
</ ActionRow >
42
47
) }
43
- blockTypeDisplayName = { intl . formatMessage ( messages . collectionType ) }
48
+ blockTypeDisplayName = { blockTypeDisplayName }
44
49
openInfoSidebar = { ( ) => { } }
45
50
/>
46
51
) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ const messages = defineMessages({
16
16
defaultMessage : 'Collection' ,
17
17
description : 'Collection type text' ,
18
18
} ,
19
+ collectionTypeWithCount : {
20
+ id : 'course-authoring.library-authoring.collection.type-with-count' ,
21
+ defaultMessage : 'Collection ({numChildren})' ,
22
+ description : 'Collection type text with children count' ,
23
+ } ,
19
24
menuEdit : {
20
25
id : 'course-authoring.library-authoring.component.menu.edit' ,
21
26
defaultMessage : 'Edit' ,
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ export interface ContentHit extends BaseContentHit {
135
135
*/
136
136
export interface CollectionHit extends BaseContentHit {
137
137
description : string ;
138
- componentCount ?: number ;
138
+ numChildren ?: number ;
139
139
}
140
140
141
141
/**
You can’t perform that action at this time.
0 commit comments