Changed: DB Params
This commit is contained in:
19
templ/generator/test-raw-elements/expected.html
Normal file
19
templ/generator/test-raw-elements/expected.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<style><!-- Some stuff --></style>
|
||||
<style>
|
||||
.customClass {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$("div").marquee();
|
||||
function test() {
|
||||
window.open("https://example.com")
|
||||
}
|
||||
</script>
|
||||
<h1>Hello</h1>
|
||||
<div>World</div>
|
||||
</body>
|
||||
</html>
|
22
templ/generator/test-raw-elements/render_test.go
Normal file
22
templ/generator/test-raw-elements/render_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package testrawelements
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"testing"
|
||||
|
||||
"github.com/a-h/templ/generator/htmldiff"
|
||||
)
|
||||
|
||||
//go:embed expected.html
|
||||
var expected string
|
||||
|
||||
func Test(t *testing.T) {
|
||||
component := Example()
|
||||
diff, err := htmldiff.Diff(component, expected)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if diff != "" {
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
23
templ/generator/test-raw-elements/template.templ
Normal file
23
templ/generator/test-raw-elements/template.templ
Normal file
@@ -0,0 +1,23 @@
|
||||
package testrawelements
|
||||
|
||||
templ Example() {
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<style><!-- Some stuff --></style>
|
||||
<style>
|
||||
.customClass {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$("div").marquee();
|
||||
function test() {
|
||||
window.open("https://example.com")
|
||||
}
|
||||
</script>
|
||||
<h1>Hello</h1>
|
||||
@templ.Raw("<div>World</div>")
|
||||
</body>
|
||||
</html>
|
||||
}
|
48
templ/generator/test-raw-elements/template_templ.go
Normal file
48
templ/generator/test-raw-elements/template_templ.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.3.833
|
||||
package testrawelements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func Example() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<html><head></head><body><style><!-- Some stuff --></style><style>\n .customClass {\n border: 1px solid black;\n }\n </style><script>\n $(\"div\").marquee();\n function test() {\n window.open(\"https://example.com\")\n }\n </script><h1>Hello</h1>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.Raw("<div>World</div>").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</body></html>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
Reference in New Issue
Block a user