github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/binding/binding_test/binding_singlefield_test.go (about) 1 package binding_test 2 3 type SingleField struct { 4 Name string `json:"name"` 5 } 6 7 func (s SingleField) Get() SingleField { 8 return s 9 } 10 11 var SingleFieldTest = BindingTest{ 12 name: "SingleField", 13 structs: []interface{}{ 14 &SingleField{}, 15 }, 16 exemptions: nil, 17 shouldError: false, 18 want: ` 19 export namespace binding_test { 20 export class SingleField { 21 name: string; 22 static createFrom(source: any = {}) { 23 return new SingleField(source); 24 } 25 constructor(source: any = {}) { 26 if ('string' === typeof source) source = JSON.parse(source); 27 this.name = source["name"]; 28 } 29 } 30 } 31 `, 32 }