File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
src/sections/Company/News-single Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -79,19 +79,16 @@ const NewsSingle = ({ data, children }) => {
7979 </ Row >
8080 </ div >
8181 {
82- frontmatter . eurl && (
82+ frontmatter . source_url ? (
8383 < div style = { { display : "flex" } } >
8484 < h5 >
85- Read the full article on < a href = { frontmatter . eurl } target = "_blank" rel = "noopener noreferrer" > { frontmatter . author } </ a >
85+ Originally published at < a href = { frontmatter . source_url } target = "_blank" rel = "noopener noreferrer" > { frontmatter . source_url } </ a >
8686 </ h5 >
8787 </ div >
88- )
89- }
90- {
91- frontmatter . source_url && (
88+ ) : frontmatter . eurl && (
9289 < div style = { { display : "flex" } } >
9390 < h5 >
94- Originally published at < a href = { frontmatter . source_url } target = "_blank" rel = "noopener noreferrer" > { frontmatter . source_url } </ a >
91+ Read the full article on < a href = { frontmatter . eurl } target = "_blank" rel = "noopener noreferrer" > { frontmatter . author } </ a >
9592 </ h5 >
9693 </ div >
9794 )
Original file line number Diff line number Diff line change @@ -57,4 +57,23 @@ describe('NewsSingle', () => {
5757 const wrapper = shallow ( < NewsSingle data = { data } /> ) ;
5858 expect ( wrapper . text ( ) ) . not . toContain ( 'Originally published at' ) ;
5959 } ) ;
60+
61+ it ( 'does not render "Read the full article on" (eurl) when source_url is present' , ( ) => {
62+ const data = {
63+ mdx : {
64+ frontmatter : {
65+ title : 'Test' ,
66+ source_url : 'https://original.com' ,
67+ eurl : 'https://eurl.com' ,
68+ author : 'Me' ,
69+ date : '2023-01-01'
70+ } ,
71+ fields : { slug : '/test' }
72+ }
73+ } ;
74+
75+ const wrapper = shallow ( < NewsSingle data = { data } /> ) ;
76+ expect ( wrapper . text ( ) ) . toContain ( 'Originally published at' ) ;
77+ expect ( wrapper . text ( ) ) . not . toContain ( 'Read the full article on' ) ;
78+ } ) ;
6079} ) ;
You can’t perform that action at this time.
0 commit comments