File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,14 +9,20 @@ class Corpora extends Component {
99 < h1 > Corpora</ h1 >
1010 {
1111 this . props . corpora . map ( ( connection ) => {
12+ let website = connection . get ( 'website' ) || ''
13+ if ( connection . get ( 'searchKeywords' ) ) {
14+ website = `${ website } /search/${ connection . get ( 'searchKeywords' ) } `
15+ } else {
16+ website = `${ website } /search`
17+ }
1218 return (
1319 < div className = 'media' key = { connection . get ( 'dbname' ) } >
14- < Link to = { connection . get ( ' website' ) + '/search' } className = 'pull-left' >
20+ < Link to = { website } className = 'pull-left' >
1521 < img src = { 'https://secure.gravatar.com/avatar/' + connection . get ( 'gravatar' ) + '.jpg?s=96&d=retro&r=pg' } alt = 'Corpus image' className = 'media-object' />
1622 </ Link >
1723 < div className = 'media-body' >
1824 < h4 className = 'media-heading' >
19- < Link to = { ` ${ connection . get ( ' website' ) } /search/ ${ connection . get ( 'searchKeywords' ) || '' } ` } >
25+ < Link to = { website } >
2026 { connection . get ( 'title' ) }
2127 </ Link >
2228 </ h4 >
Original file line number Diff line number Diff line change @@ -12,15 +12,17 @@ describe('Component::Corpora', function () {
1212 corpora : Immutable . fromJS ( [
1313 {
1414 dbname : 1 ,
15- title : 'the-title-1'
15+ title : 'the title 1' ,
16+ website : 'https://example.org'
1617 } ,
1718 {
1819 dbname : 2 ,
19- title : 'the-title-2'
20+ title : 'the title 2' ,
21+ searchKeywords : 'morphemes:nay OR gloss:caus'
2022 } ,
2123 {
2224 dbname : 3 ,
23- title : 'the- title- 3'
25+ title : 'the title 3'
2426 }
2527 ] )
2628 }
@@ -34,5 +36,10 @@ describe('Component::Corpora', function () {
3436 let corpusMaskComps = doc . find ( Link )
3537
3638 expect ( corpusMaskComps . length ) . to . equal ( props . corpora . size * 2 )
39+ expect ( corpusMaskComps . nodes [ 0 ] . props . to ) . to . equal ( 'https://example.org/search' )
40+ expect ( corpusMaskComps . nodes [ 1 ] . props . children ) . to . equal ( 'the title 1' )
41+
42+ expect ( corpusMaskComps . nodes [ 2 ] . props . to ) . to . equal ( '/search/morphemes:nay OR gloss:caus' )
43+ expect ( corpusMaskComps . nodes [ 3 ] . props . children ) . to . equal ( 'the title 2' )
3744 } )
3845} )
You can’t perform that action at this time.
0 commit comments