test_species_getter.html (932B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for ...</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <script> 8 test(function() { 9 /* global test, assert_not_equals, assert_equals */ 10 11 var desc = Object.getOwnPropertyDescriptor(Promise, Symbol.species); 12 assert_not_equals(desc, undefined, "Should have a property"); 13 14 assert_equals(desc.configurable, true, "Property should be configurable"); 15 assert_equals(desc.enumerable, false, "Property should not be enumerable"); 16 assert_equals(desc.set, undefined, "Should not have a setter"); 17 var getter = desc.get; 18 19 var things = [undefined, null, 5, "xyz", Promise, Object]; 20 for (var thing of things) { 21 assert_equals(getter.call(thing), thing, 22 "Getter should return its this value"); 23 } 24 }, "Promise should have an @@species getter that works per spec"); 25 </script>