@@ -231,62 +231,6 @@ test('should handle titles of links', () => {
231231 assert . equal ( actual , '<p>Empty: <a href="#" title="x"></a></p>' )
232232} )
233233
234- test ( 'should use target attribute for links if specified' , ( ) => {
235- const input = 'This is [a link](https://espen.codes/) to Espen.Codes.'
236- const actual = asHtml ( < Markdown children = { input } linkTarget = "_blank" /> )
237- assert . equal (
238- actual ,
239- '<p>This is <a href="https://espen.codes/" target="_blank">a link</a> to Espen.Codes.</p>'
240- )
241- } )
242-
243- test ( 'should call function to get target attribute for links if specified' , ( ) => {
244- const input = 'This is [a link](https://espen.codes/) to Espen.Codes.'
245- const actual = asHtml (
246- < Markdown
247- children = { input }
248- linkTarget = { ( uri ) => ( uri . startsWith ( 'http' ) ? '_blank' : undefined ) }
249- />
250- )
251- assert . equal (
252- actual ,
253- '<p>This is <a href="https://espen.codes/" target="_blank">a link</a> to Espen.Codes.</p>'
254- )
255- } )
256-
257- test ( 'should handle links with custom target transformer' , ( ) => {
258- const input = 'Empty: []()'
259-
260- const actual = asHtml (
261- < Markdown
262- children = { input }
263- linkTarget = { ( uri , _ , title ) => {
264- assert . equal ( uri , '' , '`uri` should be an empty string' )
265- assert . equal ( title , null , '`title` should be null' )
266- return undefined
267- } }
268- />
269- )
270-
271- assert . equal ( actual , '<p>Empty: <a href=""></a></p>' )
272- } )
273-
274- test ( 'should handle links w/ titles with custom target transformer' , ( ) => {
275- const input = 'Empty: [](a "b")'
276-
277- const actual = asHtml (
278- < Markdown
279- children = { input }
280- linkTarget = { ( _ , _1 , title ) => {
281- assert . equal ( title , 'b' , '`title` should be given' )
282- return undefined
283- } }
284- />
285- )
286-
287- assert . equal ( actual , '<p>Empty: <a href="a" title="b"></a></p>' )
288- } )
289-
290234test ( 'should support images without alt, url, or title' , ( ) => {
291235 const input = '![]()'
292236 const actual = asHtml ( < Markdown children = { input } transformLinkUri = { null } /> )
0 commit comments