OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
3 <title>Keygenerator</title> | 3 <title>Keygenerator</title> |
4 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> | 4 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> |
5 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-generator-concept"> | 5 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-generator-concept"> |
6 <link rel=assert title="The current number of a key generator is always set to 1
when the object store for that key generator is first created."> | 6 <link rel=assert title="The current number of a key generator is always set to 1
when the object store for that key generator is first created."> |
7 <link rel=assert title="When a key generator is used to generate a new key for a
object store, the key generator's current number is used as the new key value a
nd then the key generator's current number is increased by 1."> | 7 <link rel=assert title="When a key generator is used to generate a new key for a
object store, the key generator's current number is used as the new key value a
nd then the key generator's current number is increased by 1."> |
8 <link rel=assert title="When a record is stored in a object store which uses a k
ey generator, and an explicit key is defined, if the key's value is a float grea
ter than or equal to the key generator's current number, then the key generator'
s current number is set to the smallest integer number larger than the explicit
key. Only explicit keys which are float values affect the current number of the
key generator."> | 8 <link rel=assert title="When a record is stored in a object store which uses a k
ey generator, and an explicit key is defined, if the key's value is a float grea
ter than or equal to the key generator's current number, then the key generator'
s current number is set to the smallest integer number larger than the explicit
key. Only explicit keys which are float values affect the current number of the
key generator."> |
9 <script src="../../../resources/testharness.js"></script> | 9 <script src="../../../resources/testharness.js"></script> |
10 <script src="../../../resources/testharnessreport.js"></script> | 10 <script src="../../../resources/testharnessreport.js"></script> |
(...skipping 25 matching lines...) Expand all Loading... |
36 .openCursor(); | 36 .openCursor(); |
37 | 37 |
38 rq.onsuccess = t.step_func(function(e) { | 38 rq.onsuccess = t.step_func(function(e) { |
39 var cursor = e.target.result; | 39 var cursor = e.target.result; |
40 | 40 |
41 if (cursor) { | 41 if (cursor) { |
42 actual_keys.push(cursor.key.valueOf()); | 42 actual_keys.push(cursor.key.valueOf()); |
43 cursor.continue(); | 43 cursor.continue(); |
44 } | 44 } |
45 else { | 45 else { |
46 assert_equals(actual_keys.length, expected_keys.length, "arr
ay length"); | 46 assert_key_equals(actual_keys, expected_keys, "keygenerator
array"); |
47 assert_object_equals(actual_keys, expected_keys, "keygenerat
or array"); | |
48 | |
49 t.done(); | 47 t.done(); |
50 } | 48 } |
51 }); | 49 }); |
52 }; | 50 }; |
53 } | 51 } |
54 | 52 |
55 | 53 |
56 keygenerator([null, null, null, null], [1, 2, 3, 4], | 54 keygenerator([null, null, null, null], [1, 2, 3, 4], |
57 "starts at one, and increments by one"); | 55 "starts at one, and increments by one"); |
58 | 56 |
59 keygenerator([2, null, 5, null, 6.66, 7], [2, 3, 5, 6, 6.66, 7], | 57 keygenerator([2, null, 5, null, 6.66, 7], [2, 3, 5, 6, 6.66, 7], |
60 "increments by one from last set key"); | 58 "increments by one from last set key"); |
61 | 59 |
62 keygenerator([-10, null, "6", 6.3, [10], -2, 4, null], [-10, -2, 1, 4, 6.3
, 7, "6", [10]], | 60 keygenerator([-10, null, "6", 6.3, [10], -2, 4, null], [-10, -2, 1, 4, 6.3
, 7, "6", [10]], |
63 "don't increment when new key is not bigger than current"); | 61 "don't increment when new key is not bigger than current"); |
64 | 62 |
65 </script> | 63 </script> |
66 | 64 |
67 <div id="log"></div> | 65 <div id="log"></div> |
OLD | NEW |