File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2031,6 +2031,13 @@ extern "C" {
2031
2031
#[ wasm_bindgen( static_method_of = Object , js_name = getOwnPropertyDescriptor) ]
2032
2032
pub fn get_own_property_descriptor ( obj : & Object , prop : & JsValue ) -> JsValue ;
2033
2033
2034
+ /// The Object.getOwnPropertyDescriptors() method returns all own
2035
+ /// property descriptors of a given object.
2036
+ ///
2037
+ /// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors)
2038
+ #[ wasm_bindgen( static_method_of = Object , js_name = getOwnPropertyDescriptors) ]
2039
+ pub fn get_own_property_descriptors ( obj : & Object ) -> JsValue ;
2040
+
2034
2041
/// The `hasOwnProperty()` method returns a boolean indicating whether the
2035
2042
/// object has the specified property as its own property (as opposed to
2036
2043
/// inheriting it).
Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ fn get_own_property_descriptor() {
114
114
assert ! ( PropertyDescriptor :: from( desc) . value( ) . is_undefined( ) ) ;
115
115
}
116
116
117
+ #[ wasm_bindgen_test]
118
+ fn get_own_property_descriptors ( ) {
119
+ let foo = foo_42 ( ) ;
120
+ let descriptors = Object :: get_own_property_descriptors ( & foo) ;
121
+ let foo_desc = Reflect :: get ( & descriptors, & "foo" . into ( ) ) ;
122
+ assert_eq ! ( PropertyDescriptor :: from( foo_desc) . value( ) , 42 ) ;
123
+ }
124
+
117
125
#[ wasm_bindgen_test]
118
126
fn has_own_property ( ) {
119
127
assert ! ( foo_42( ) . has_own_property( & "foo" . into( ) ) ) ;
You can’t perform that action at this time.
0 commit comments