File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,12 @@ global.Shape = class Shape {
18
18
getShape ( ) {
19
19
return this . kind ;
20
20
}
21
+
22
+ get shapeTypeNone ( ) {
23
+ return null ;
24
+ }
25
+
26
+ get shapeTypeSome ( ) {
27
+ return this . kind ;
28
+ }
21
29
} ;
Original file line number Diff line number Diff line change @@ -35,3 +35,17 @@ fn invalid_enum_return() {
35
35
_ => { } // Success
36
36
} ;
37
37
}
38
+
39
+ #[ wasm_bindgen_test]
40
+ fn read_optional_enum_attribute_none ( ) {
41
+ let shape = Shape :: new ( ShapeType :: Circle ) . unwrap ( ) ;
42
+ let shape_type: Option < ShapeType > = shape. shape_type_none ( ) ;
43
+ assert_eq ! ( shape_type, None ) ;
44
+ }
45
+
46
+ #[ wasm_bindgen_test]
47
+ fn read_optional_enum_attribute_some ( ) {
48
+ let shape = Shape :: new ( ShapeType :: Circle ) . unwrap ( ) ;
49
+ let shape_type: Option < ShapeType > = shape. shape_type_some ( ) ;
50
+ assert_eq ! ( shape_type, Some ( ShapeType :: Circle ) ) ;
51
+ }
Original file line number Diff line number Diff line change @@ -12,4 +12,8 @@ interface Shape {
12
12
13
13
[Pure ]
14
14
ShapeType getShape ();
15
+
16
+ readonly attribute ShapeType? shapeTypeNone;
17
+
18
+ readonly attribute ShapeType? shapeTypeSome;
15
19
};
You can’t perform that action at this time.
0 commit comments