Skip to content

Commit

Permalink
Fix: error on relative image path
Browse files Browse the repository at this point in the history
  • Loading branch information
tai2 committed Nov 5, 2023
1 parent 4da96e0 commit b2d5d78
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
7 changes: 0 additions & 7 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/template_renderer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extname } from './deps/std/url.ts'
import { extname } from './deps/std/path.ts'
import { contentType } from './deps/std/media_types.ts'
import { Element } from './deps/deno-dom.ts'
import { cleanUrl, escape } from './deps/marked.ts'
Expand Down
17 changes: 17 additions & 0 deletions src/template_renderer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,23 @@ Deno.test(
},
)

Deno.test(
'`templateRenderer.image` can receive and render relative image path',
() => {
const imageTemplate = parseDomFragment(
`<img data-decor-attribute-src="url" data-decor-attribute-title="title" data-decor-attribute-alt="description">`,
).children[0]

assertEquals(
templateRenderer({
...testTemplate,
image: imageTemplate,
}).image('a.jpeg', 'title text', 'description text'),
`<img data-decor-attribute-src="url" data-decor-attribute-title="title" data-decor-attribute-alt="description" src="a.jpeg" title="title text" alt="description text">`,
)
},
)

Deno.test(
'`templateRenderer.image` renders received parameters with video template when the file extention is a video one',
() => {
Expand Down

0 comments on commit b2d5d78

Please sign in to comment.