github.com/AlpineAIO/wails/v2@v2.0.0-beta.32.0.20240505041856-1047a8fa5fef/internal/binding/binding_test/binding_importedenum_test.go (about)

     1  package binding_test
     2  
     3  import "github.com/AlpineAIO/wails/v2/internal/binding/binding_test/binding_test_import"
     4  
     5  type ImportedEnumStruct struct {
     6  	EnumValue binding_test_import.ImportedEnum `json:"EnumValue"`
     7  }
     8  
     9  func (s ImportedEnumStruct) Get() ImportedEnumStruct {
    10  	return s
    11  }
    12  
    13  var ImportedEnumTest = BindingTest{
    14  	name: "ImportedEnum",
    15  	structs: []interface{}{
    16  		&ImportedEnumStruct{},
    17  	},
    18  	enums: []interface{}{
    19  		binding_test_import.AllImportedEnumValues,
    20  	},
    21  	exemptions:  nil,
    22  	shouldError: false,
    23  	want: `export namespace binding_test {
    24          	
    25          	export class ImportedEnumStruct {
    26          	    EnumValue: binding_test_import.ImportedEnum;
    27          	
    28          	    static createFrom(source: any = {}) {
    29          	        return new ImportedEnumStruct(source);
    30          	    }
    31          	
    32          	    constructor(source: any = {}) {
    33          	        if ('string' === typeof source) source = JSON.parse(source);
    34          	        this.EnumValue = source["EnumValue"];
    35          	    }
    36          	}
    37          
    38          }
    39          
    40          export namespace binding_test_import {
    41          	
    42          	export enum ImportedEnum {
    43          	    Value1 = "value1",
    44          	    Value2 = "value2",
    45          	    Value3 = "value3",
    46          	}
    47          
    48          }
    49  `,
    50  }