Changed: DB Params
This commit is contained in:
7
templ/generator/test-only-scripts/expected.html
Normal file
7
templ/generator/test-only-scripts/expected.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<script>
|
||||
function __templ_withParameters_1056(a, b, c){console.log(a, b, c);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
__templ_withParameters_1056("hello","world",42069)
|
||||
</script>
|
23
templ/generator/test-only-scripts/render_test.go
Normal file
23
templ/generator/test-only-scripts/render_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package onlyscripts
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"testing"
|
||||
|
||||
"github.com/a-h/templ/generator/htmldiff"
|
||||
)
|
||||
|
||||
//go:embed expected.html
|
||||
var expected string
|
||||
|
||||
func Test(t *testing.T) {
|
||||
script := withParameters("hello", "world", 42069)
|
||||
|
||||
diff, err := htmldiff.Diff(script, expected)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if diff != "" {
|
||||
t.Error(diff)
|
||||
}
|
||||
}
|
5
templ/generator/test-only-scripts/template.templ
Normal file
5
templ/generator/test-only-scripts/template.templ
Normal file
@@ -0,0 +1,5 @@
|
||||
package onlyscripts
|
||||
|
||||
script withParameters(a string, b string, c int) {
|
||||
console.log(a, b, c);
|
||||
}
|
21
templ/generator/test-only-scripts/template_templ.go
Normal file
21
templ/generator/test-only-scripts/template_templ.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.3.833
|
||||
package onlyscripts
|
||||
|
||||
//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 withParameters(a string, b string, c int) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_withParameters_1056`,
|
||||
Function: `function __templ_withParameters_1056(a, b, c){console.log(a, b, c);
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_withParameters_1056`, a, b, c),
|
||||
CallInline: templ.SafeScriptInline(`__templ_withParameters_1056`, a, b, c),
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
Reference in New Issue
Block a user