initial commits

master
Charles Iliya Krempeaux 2024-02-14 16:29:57 -08:00
parent 2b24feddab
commit 4f79731e90
2 changed files with 12 additions and 12 deletions

View File

@ -15,7 +15,7 @@ package frameproto
// Would append this HTML <meta/> element:
//
// <meta property="fc:frame:input:text" content="enter your username" />
func AppendFrameInputText(p []byte, url string) []byte {
func AppendFrameInputText(p []byte, label string) []byte {
const property string = MetaPropertyFrameInputText
return appendMetaPropertyContent(p, property, url)
return appendMetaPropertyContent(p, property, label)
}

View File

@ -7,39 +7,39 @@ import (
func TestAppendFrameInputText(t *testing.T) {
tests := []struct{
Version string
Label string
Expected string
}{
{
Version: "",
Label: "",
Expected: `<meta property="fc:frame:input:text" content="" />`+"\n",
},
{
Version: "something",
Label: "something",
Expected: `<meta property="fc:frame:input:text" content="something" />`+"\n",
},
{
Version: "Hello world! 🙂",
Label: "Hello world! 🙂",
Expected: `<meta property="fc:frame:input:text" content="Hello world! 🙂" />`+"\n",
},
{
Version: "enter your username",
Label: "enter your username",
Expected: `<meta property="fc:frame:input:text" content="enter your username" />`+"\n",
},
{
Version: "I like to eat, eat, eat, apples and banana",
Label: "I like to eat, eat, eat, apples and banana",
Expected: `<meta property="fc:frame:input:text" content="I like to eat, eat, eat, apples and banana" />`+"\n",
},
}
@ -50,7 +50,7 @@ func TestAppendFrameInputText(t *testing.T) {
var buffer [256]byte
var p []byte = buffer[0:0]
p = AppendFrameInputText(p, test.Version)
p = AppendFrameInputText(p, test.Label)
expected := test.Expected
actual := string(p)
@ -61,7 +61,7 @@ func TestAppendFrameInputText(t *testing.T) {
t.Logf("ACTUAL: %s", actual)
t.Logf("EXPECTED: %q", expected)
t.Logf("ACTUAL: %q", actual)
t.Logf("LABEL: %q", test.Version)
t.Logf("LABEL: %q", test.Label)
continue
}
}
@ -75,7 +75,7 @@ func TestAppendFrameInputText(t *testing.T) {
p = append(p, top...)
p = AppendFrameInputText(p, test.Version)
p = AppendFrameInputText(p, test.Label)
p = append(p, bottom...)
@ -88,7 +88,7 @@ func TestAppendFrameInputText(t *testing.T) {
t.Logf("ACTUAL: %s", actual)
t.Logf("EXPECTED: %q", expected)
t.Logf("ACTUAL: %q", actual)
t.Logf("LABEL: %q", test.Version)
t.Logf("LABEL: %q", test.Label)
continue
}
}