Skip to content

Commit

Permalink
test: twemoji svg and png render
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed May 23, 2023
1 parent e3511ee commit 0c3b802
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 8 additions & 2 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ describe('ssr', async () => {
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
})

it('renders the index page', async () => {
it('renders heart emoji as SVG', async () => {
// Get response to a server-rendered page with `$fetch`.
const html = await $fetch('/')
expect(html).toContain('<div>basic</div>')
expect(html).toContain('<svg class="twemoji" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" width="1em" height="1em"><path fill="#DD2E44" d="M35.885 11.833c0-5.45-4.418-9.868-9.867-9.868-3.308 0-6.227 1.633-8.018 4.129-1.791-2.496-4.71-4.129-8.017-4.129-5.45 0-9.868 4.417-9.868 9.868 0 .772.098 1.52.266 2.241C1.751 22.587 11.216 31.568 18 34.034c6.783-2.466 16.249-11.447 17.617-19.959.17-.721.268-1.469.268-2.242z"/></svg>')
})

it('renders heart emoji as PNG', async () => {
// Get response to a server-rendered page with `$fetch`.
const html = await $fetch('/')
expect(html).toContain('<img class="twemoji" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/2764.png" alt="2764" style="width:1em;height:1em;">')
})
})
6 changes: 2 additions & 4 deletions test/fixtures/basic/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<template>
<div>basic</div>
<Twemoji emoji="2764" />
<Twemoji emoji="2764" png />
</template>

<script setup>
</script>

0 comments on commit 0c3b802

Please sign in to comment.