OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>IDBCursor.key</title> | 2 <title>IDBCursor.key</title> |
3 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> | 3 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> |
4 <script src="../../../resources/testharness.js"></script> | 4 <script src="../../../resources/testharness.js"></script> |
5 <script src="../../../resources/testharnessreport.js"></script> | 5 <script src="../../../resources/testharnessreport.js"></script> |
6 <script src="support.js"></script> | 6 <script src="support.js"></script> |
7 | 7 |
8 <script> | 8 <script> |
9 | 9 |
10 function cursor_key(key) | 10 function cursor_key(key) |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 open_rq.onsuccess = t.step_func(function(e) { | 23 open_rq.onsuccess = t.step_func(function(e) { |
24 var cursor_rq = db.transaction("test") | 24 var cursor_rq = db.transaction("test") |
25 .objectStore("test") | 25 .objectStore("test") |
26 .openCursor(); | 26 .openCursor(); |
27 | 27 |
28 cursor_rq.onsuccess = t.step_func(function(e) { | 28 cursor_rq.onsuccess = t.step_func(function(e) { |
29 var cursor = e.target.result; | 29 var cursor = e.target.result; |
30 assert_equals(cursor.value, "data", "prequisite cursor.value"); | 30 assert_equals(cursor.value, "data", "prequisite cursor.value"); |
31 | 31 |
32 assert_object_equals(cursor.key, key, 'key'); | 32 assert_key_equals(cursor.key, key, 'key'); |
33 assert_readonly(cursor, 'key'); | 33 assert_readonly(cursor, 'key'); |
34 | 34 |
35 if (key instanceof Array) { | 35 if (key instanceof Array) { |
36 cursor.key.push("new"); | 36 cursor.key.push("new"); |
37 key.push("new"); | 37 key.push("new"); |
38 | 38 |
39 assert_object_equals(cursor.key, key, 'key after array push'
); | 39 assert_key_equals(cursor.key, key, 'key after array push'); |
40 | 40 |
41 // But we can not change key (like readonly, just a bit diff
erent) | 41 // But we can not change key (like readonly, just a bit diff
erent) |
42 cursor.key = 10; | 42 cursor.key = 10; |
43 assert_object_equals(cursor.key, key, 'key after assignment'
); | 43 assert_key_equals(cursor.key, key, 'key after assignment'); |
44 } | 44 } |
45 | 45 |
46 t.done(); | 46 t.done(); |
47 }); | 47 }); |
48 }); | 48 }); |
49 } | 49 } |
50 | 50 |
51 cursor_key(1); | 51 cursor_key(1); |
52 cursor_key("key"); | 52 cursor_key("key"); |
53 cursor_key(["my", "key"]); | 53 cursor_key(["my", "key"]); |
54 | 54 |
55 </script> | 55 </script> |
56 | 56 |
57 <div id="log"></div> | 57 <div id="log"></div> |
OLD | NEW |