progressevent-interface.html (1722B)
1 <!DOCTYPE html> 2 <title>The ProgressEvent interface</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id="log"></div> 6 <script> 7 test(function() { 8 assert_equals(typeof ProgressEvent, "function") 9 assert_equals(ProgressEvent.length, 1) 10 }) 11 test(function() { 12 var desc = Object.getOwnPropertyDescriptor(ProgressEvent, "prototype") 13 assert_equals(desc.value, ProgressEvent.prototype) 14 assert_equals(desc.writable, false) 15 assert_equals(desc.enumerable, false) 16 assert_equals(desc.configurable, false) 17 assert_throws_js(TypeError, function() { 18 "use strict"; 19 delete ProgressEvent.prototype; 20 }) 21 assert_equals(ProgressEvent.prototype.constructor, ProgressEvent) 22 assert_equals(Object.getPrototypeOf(ProgressEvent.prototype), Event.prototype) 23 }, "interface prototype object") 24 var attributes = [ 25 ["boolean", "lengthComputable"], 26 ["double", "loaded"], 27 ["double", "total"] 28 ]; 29 attributes.forEach(function(a) { 30 test(function() { 31 var desc = Object.getOwnPropertyDescriptor(ProgressEvent.prototype, a[1]) 32 assert_equals(desc.enumerable, true) 33 assert_equals(desc.configurable, true) 34 assert_throws_js(TypeError, function() { 35 ProgressEvent.prototype[a[1]] 36 }) 37 }) 38 }) 39 test(function() { 40 for (var p in window) { 41 assert_not_equals(p, "ProgressEvent") 42 } 43 }, "Interface objects properties should not be Enumerable") 44 test(function() { 45 assert_true(!!window.ProgressEvent, "Interface should exist.") 46 assert_true(delete window.ProgressEvent, "The delete operator should return true.") 47 assert_equals(window.ProgressEvent, undefined, "Interface should be gone.") 48 }, "Should be able to delete ProgressEvent.") 49 </script>