5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:22:01 +08:00
wails/v2/internal/binding/binding_test/binding_variablespecialcharacter_test.go
Gjergji Ramku a7a4341f79
Special chars bindings unit tests (#3485)
* JSON fields that start with special characters generate wrong typescript bindings

* Update changelong
2024-05-17 18:32:54 +10:00

33 lines
689 B
Go

package binding_test
type SpecialCharacterField struct {
ID string `json:"@ID,omitempty"`
}
func (s SpecialCharacterField) Get() SpecialCharacterField {
return s
}
var SpecialCharacterFieldTest = BindingTest{
name: "SpecialCharacterField",
structs: []interface{}{
&SpecialCharacterField{},
},
exemptions: nil,
shouldError: false,
want: `
export namespace binding_test {
export class SpecialCharacterField {
"@ID"?: string;
static createFrom(source: any = {}) {
return new SpecialCharacterField(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this["@ID"] = source["@ID"];
}
}
}
`,
}