@@ -63,6 +63,31 @@ module('Integration | Component | hds/link/inline', function (hooks) {
6363 assert . dom ( '#test-link > span' ) . hasText ( 'test' ) ;
6464 } ) ;
6565
66+ // TARGET/REL ATTRIBUTES
67+
68+ test ( 'it should render a <a> link with the right "target" and "rel" attributes if @href is passed' , async function ( assert ) {
69+ assert . expect ( 2 ) ;
70+ await render ( hbs `<Hds::Link::Inline @href="/" id="test-link" />` ) ;
71+ assert . dom ( '#test-link' ) . hasAttribute ( 'target' , '_blank' ) ;
72+ assert . dom ( '#test-link' ) . hasAttribute ( 'rel' , 'noopener noreferrer' ) ;
73+ } ) ;
74+ test ( 'it should render a <a> link with custom "target" and "rel" attributes if they are passed as attributes' , async function ( assert ) {
75+ assert . expect ( 2 ) ;
76+ await render (
77+ hbs `<Hds::Link::Inline @href="/" id="test-link" target="test-target" rel="test-rel" />`
78+ ) ;
79+ assert . dom ( '#test-link' ) . hasAttribute ( 'target' , 'test-target' ) ;
80+ assert . dom ( '#test-link' ) . hasAttribute ( 'rel' , 'test-rel' ) ;
81+ } ) ;
82+ test ( 'it should render a <a> link withhout "target" and "rel" attributes if @isHrefExternal is false' , async function ( assert ) {
83+ assert . expect ( 2 ) ;
84+ await render (
85+ hbs `<Hds::Link::Inline @href="/" @isHrefExternal={{false}} id="test-link" />`
86+ ) ;
87+ assert . dom ( '#test-link' ) . doesNotHaveAttribute ( 'target' ) ;
88+ assert . dom ( '#test-link' ) . doesNotHaveAttribute ( 'rel' ) ;
89+ } ) ;
90+
6691 // ASSERTIONS
6792
6893 test ( 'it should throw an assertion if both @href and @route are not defined' , async function ( assert ) {
@@ -79,13 +104,13 @@ module('Integration | Component | hds/link/inline', function (hooks) {
79104 } ) ;
80105 test ( 'it should throw an assertion if an incorrect value for @color is provided' , async function ( assert ) {
81106 const errorMessage =
82- '@color for "Hds::Link::Standalone " must be one of the following: primary, secondary; received: foo' ;
107+ '@color for "Hds::Link::Inline " must be one of the following: primary, secondary; received: foo' ;
83108 assert . expect ( 2 ) ;
84109 setupOnerror ( function ( error ) {
85110 assert . strictEqual ( error . message , `Assertion Failed: ${ errorMessage } ` ) ;
86111 } ) ;
87112 await render (
88- hbs `<Hds::Link::Standalone @icon="film" @text="watch video" @href="/" @color="foo" />`
113+ hbs `<Hds::Link::Inline @icon="film" @text="watch video" @href="/" @color="foo" />`
89114 ) ;
90115 assert . throws ( function ( ) {
91116 throw new Error ( errorMessage ) ;
0 commit comments