Commit 384d3adc authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Ensure content-banner links open in a new tab

parent b342720c
...@@ -106,6 +106,7 @@ export default function ContentInfoBanner({ info }) { ...@@ -106,6 +106,7 @@ export default function ContentInfoBanner({ info }) {
title={itemTitle} title={itemTitle}
href={info.links.currentItem} href={info.links.currentItem}
data-testid="content-item-link" data-testid="content-item-link"
target="_blank"
> >
{itemTitle} {itemTitle}
</LinkUnstyled> </LinkUnstyled>
......
...@@ -46,8 +46,9 @@ describe('ContentInfoBanner', () => { ...@@ -46,8 +46,9 @@ describe('ContentInfoBanner', () => {
it('shows item title', () => { it('shows item title', () => {
const wrapper = createComponent(); const wrapper = createComponent();
const title = wrapper.find('LinkUnstyled[data-testid="content-item-link"]'); const link = wrapper.find('LinkUnstyled[data-testid="content-item-link"]');
assert.equal(title.text(), 'Chapter 2: Some book chapter'); assert.equal(link.text(), 'Chapter 2: Some book chapter');
assert.equal(link.prop('target'), '_blank');
}); });
it('provides disclosure of long titles through title attributes', () => { it('provides disclosure of long titles through title attributes', () => {
...@@ -80,10 +81,12 @@ describe('ContentInfoBanner', () => { ...@@ -80,10 +81,12 @@ describe('ContentInfoBanner', () => {
prevLink.prop('href'), prevLink.prop('href'),
'https://www.jstor.org/stable/book.123.1' 'https://www.jstor.org/stable/book.123.1'
); );
assert.equal(prevLink.prop('target'), '_blank');
assert.equal( assert.equal(
nextLink.prop('href'), nextLink.prop('href'),
'https://www.jstor.org/stable/book.123.3' 'https://www.jstor.org/stable/book.123.3'
); );
assert.equal(nextLink.prop('target'), '_blank');
}); });
it('does not display previous link if unavailable', () => { it('does not display previous link if unavailable', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment