Skip to content

Commit ae79053

Browse files
merge: merge main
2 parents 13b244e + e4f8783 commit ae79053

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# 0.6.4 - 8 Sep 2023
2-
Bug fix:
3-
- Fix createElement not rendering
1+
# 0.6.5 - 11 Sep 2023
2+
Improvement:
3+
- Export `Children`, `PropsWithChildren`, `Component`, and `Fragment`
4+
- [#12](https://github.com/elysiajs/elysia-html/pull/12) Drop global flag
45

56
# 0.6.3 - 8 Sep 2023
67
Improvement:

example/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Elysia } from 'elysia'
2-
import { html } from '../src/index'
2+
import { html, Fragment } from '../src/index'
33

4-
const page = `
5-
<html lang="en">
4+
const page = `<html lang="en">
65
<head>
76
<title>Hello World</title>
87
</head>
@@ -27,9 +26,9 @@ const app = new Elysia()
2726
.get('/', () => page)
2827
.get('/jsx', () => jsx)
2928
.get('/html', ({ html }) => html(page))
30-
.get('/a', () => {
29+
.get('/a', () => (
3130
<>
3231
<h1>Hello World</h1>
3332
</>
34-
})
33+
))
3534
.listen(8080)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elysiajs/html",
3-
"version": "0.6.4",
3+
"version": "0.6.5",
44
"description": "Plugin for Elysia that add support for returning html",
55
"author": {
66
"name": "saltyAom",

test/index.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,15 @@ describe('HTML', () => {
4949
const res = await app.handle(req('/'))
5050
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
5151
})
52+
53+
it('consistently identifies html content', async () => {
54+
const app = new Elysia().use(html()).get('/', () => `<h1>Hi</h1>`)
55+
56+
let res = await app.handle(req('/'))
57+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
58+
res = await app.handle(req('/'))
59+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
60+
res = await app.handle(req('/'))
61+
expect(res.headers.get('Content-type')).toContain('text/html; charset=utf8')
62+
})
5263
})

0 commit comments

Comments
 (0)