mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 03:01:45 +08:00
Special chars bindings unit tests (#3485)
* JSON fields that start with special characters generate wrong typescript bindings * Update changelong
This commit is contained in:
parent
d4dabc1289
commit
a7a4341f79
@ -48,6 +48,7 @@ func TestBindings_GenerateModels(t *testing.T) {
|
||||
AnonymousSubStructMultiLevelTest,
|
||||
GeneratedJsEntityWithNestedStructTest,
|
||||
EntityWithDiffNamespaces,
|
||||
SpecialCharacterFieldTest,
|
||||
}
|
||||
|
||||
testLogger := &logger.Logger{}
|
||||
|
@ -0,0 +1,32 @@
|
||||
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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
}
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
- Support for compiling with `libwebkit2gtk-4.1` instead of `4.0` to support latest Ubuntu release by [atterpac](https://github.com/atterpac) in [#3465](https://github.com/wailsapp/wails/pull/3465)
|
||||
- Unit test for fix [#3476](https://github.com/wailsapp/wails/pull/3476) by [gjergj](https://github.com/Gjergj) in [#3485](https://github.com/wailsapp/wails/pull/3485)
|
||||
|
||||
### Changed
|
||||
- Updated several broken links in the "How Does It Work?" page on the website. Changed by [@oguz-yilmaz](https://github.com/oguz-yilmaz) in [PR #3469](https://github.com/wailsapp/wails/pull/3469)
|
||||
|
Loading…
Reference in New Issue
Block a user