@@ -383,7 +383,9 @@ describe('collections', () => {
383
383
} ) ;
384
384
385
385
describe ( 'selectEntryCollectionTitle' , ( ) => {
386
- const entry = fromJS ( { data : { title : 'entry title' , otherField : 'other field' } } ) ;
386
+ const entry = fromJS ( {
387
+ data : { title : 'entry title' , otherField : 'other field' , emptyLinkTitle : '' } ,
388
+ } ) ;
387
389
388
390
it ( 'should return the entry title if set' , ( ) => {
389
391
const collection = fromJS ( {
@@ -413,6 +415,24 @@ describe('collections', () => {
413
415
expect ( selectEntryCollectionTitle ( collection , entry ) ) . toEqual ( 'other field' ) ;
414
416
} ) ;
415
417
418
+ it ( 'should return the entry title if identifier_field content is not defined in collection' , ( ) => {
419
+ const collection = fromJS ( {
420
+ identifier_field : 'missingLinkTitle' ,
421
+ fields : [ { name : 'title' } , { name : 'otherField' } ] ,
422
+ } ) ;
423
+
424
+ expect ( selectEntryCollectionTitle ( collection , entry ) ) . toEqual ( 'entry title' ) ;
425
+ } ) ;
426
+
427
+ it ( 'should return the entry title if identifier_field content is empty' , ( ) => {
428
+ const collection = fromJS ( {
429
+ identifier_field : 'emptyLinkTitle' ,
430
+ fields : [ { name : 'title' } , { name : 'otherField' } , { name : 'emptyLinkTitle' } ] ,
431
+ } ) ;
432
+
433
+ expect ( selectEntryCollectionTitle ( collection , entry ) ) . toEqual ( 'entry title' ) ;
434
+ } ) ;
435
+
416
436
it ( 'should return the entry label of a file collection' , ( ) => {
417
437
const labelEntry = fromJS ( {
418
438
slug : 'entry-name' ,
0 commit comments