Skip to content

Commit

Permalink
Fix json tests with name removed
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Oct 5, 2024
1 parent 657280e commit 2b9aa85
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/gui/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import (
)

const labelJSON = `{
"Type": "*widget.Label",
"Name": "%s",
"Type": "*widget.Label",%s
"Struct": {
"Hidden": false,
"Text": "Hi",
Expand Down Expand Up @@ -72,7 +71,7 @@ var splitJSON = `{
func TestDecodeObject(t *testing.T) {
guidefs.InitOnce()

buf := bytes.NewReader([]byte(fmt.Sprintf(labelJSON, "myLabel")))
buf := bytes.NewReader([]byte(fmt.Sprintf(labelJSON, "\n \"Name\": \"myLabel\",")))
obj, meta, err := DecodeObject(buf)
assert.Nil(t, err)

Expand Down Expand Up @@ -116,7 +115,7 @@ func TestEncodeObject(t *testing.T) {
var buf bytes.Buffer
err := EncodeObject(l, meta, &buf)
assert.Nil(t, err)
assert.Equal(t, fmt.Sprintf(labelJSON, "myLabel")+"\n", buf.String())
assert.Equal(t, fmt.Sprintf(labelJSON, "\n \"Name\": \"myLabel\",")+"\n", buf.String())
}

func TestEncodeSplit(t *testing.T) {
Expand Down

0 comments on commit 2b9aa85

Please sign in to comment.