1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/imptests/html/js/builtins/test_Array.DefineOwnProperty.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,24 @@ 1.4 +<!doctype html> 1.5 +<title>Array.[[DefineOwnProperty]]</title> 1.6 +<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger> 1.7 +<link rel=help href=http://es5.github.com/#x15.4.5.1> 1.8 +<script src=/resources/testharness.js></script> 1.9 +<script src=/resources/testharnessreport.js></script> 1.10 +<div id=log></div> 1.11 +<script> 1.12 +test(function() { 1.13 + var arr = new Array; 1.14 + assert_equals(arr.length, 0); 1.15 + 1.16 + var called = 0; 1.17 + Object.defineProperty(arr, 0, { get: function() { ++called; return 7 } }); 1.18 + assert_equals(arr.length, 1); 1.19 + assert_equals(called, 0); 1.20 + 1.21 + assert_equals(arr[0], 7); 1.22 + assert_equals(called, 1); 1.23 + 1.24 + assert_equals(String(arr), "7"); 1.25 + assert_equals(called, 2); 1.26 +}); 1.27 +</script>