Add binding for Object.getOwnPropertyDescriptors()

This commit is contained in:
Michael Hoffmann
2018-09-16 23:02:46 +02:00
parent b005e96fd9
commit 2d91fa11b5
2 changed files with 15 additions and 0 deletions

View File

@ -114,6 +114,14 @@ fn get_own_property_descriptor() {
assert!(PropertyDescriptor::from(desc).value().is_undefined());
}
#[wasm_bindgen_test]
fn get_own_property_descriptors() {
let foo = foo_42();
let descriptors = Object::get_own_property_descriptors(&foo);
let foo_desc = Reflect::get(&descriptors, &"foo".into());
assert_eq!(PropertyDescriptor::from(foo_desc).value(), 42);
}
#[wasm_bindgen_test]
fn has_own_property() {
assert!(foo_42().has_own_property(&"foo".into()));