OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> | 3 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 <script src="../../fast/js/resources/js-test-post-function.js"></script> | 5 <script src="../../fast/js/resources/js-test-post-function.js"></script> |
6 <script src="resources/shared.js"></script> | 6 <script src="resources/shared.js"></script> |
7 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <p id="description"></p> | 9 <p id="description"></p> |
10 <div id="console"></div> | 10 <div id="console"></div> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 trans.onabort = unexpectedAbortCallback; | 42 trans.onabort = unexpectedAbortCallback; |
43 | 43 |
44 deleteAllObjectStores(db, createIndex); | 44 deleteAllObjectStores(db, createIndex); |
45 } | 45 } |
46 | 46 |
47 function createIndex() | 47 function createIndex() |
48 { | 48 { |
49 window.store = evalAndLog("db.createObjectStore('storeName', null)"); | 49 window.store = evalAndLog("db.createObjectStore('storeName', null)"); |
50 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); | 50 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); |
51 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', false
)"); | 51 window.indexObject2 = evalAndLog("store.createIndex('indexName2', 'y', false
)"); |
| 52 window.indexObject3 = evalAndLog("store.createIndex('zIndex', 'z', true)"); |
52 addData(); | 53 addData(); |
53 } | 54 } |
54 | 55 |
55 function addData() | 56 function addData() |
56 { | 57 { |
57 shouldBeTrue("'name' in indexObject"); | 58 shouldBeTrue("'name' in indexObject"); |
58 shouldBeEqualToString("indexObject.name", "indexName"); | 59 shouldBeEqualToString("indexObject.name", "indexName"); |
59 shouldBeTrue("'storeName' in indexObject"); | 60 shouldBeTrue("'storeName' in indexObject"); |
60 shouldBeEqualToString("indexObject.storeName", "storeName"); | 61 shouldBeEqualToString("indexObject.storeName", "storeName"); |
61 shouldBeTrue("'keyPath' in indexObject"); | 62 shouldBeTrue("'keyPath' in indexObject"); |
62 shouldBeEqualToString("indexObject.keyPath", "x"); | 63 shouldBeEqualToString("indexObject.keyPath", "x"); |
63 shouldBeTrue("'unique' in indexObject"); | 64 shouldBeTrue("'unique' in indexObject"); |
64 shouldBeFalse("indexObject.unique"); | 65 shouldBeFalse("indexObject.unique"); |
65 shouldBeTrue("'openKeyCursor' in indexObject"); | 66 shouldBeTrue("'openKeyCursor' in indexObject"); |
66 shouldBeTrue("'openCursor' in indexObject"); | 67 shouldBeTrue("'openCursor' in indexObject"); |
67 shouldBeTrue("'getKey' in indexObject"); | 68 shouldBeTrue("'getKey' in indexObject"); |
68 shouldBeTrue("'get' in indexObject"); | 69 shouldBeTrue("'get' in indexObject"); |
69 | 70 |
70 result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')"); | 71 result = evalAndLog("store.add({x: 'value', y: 'zzz', z: 2.72}, 'key')"); |
71 verifyResult(result); | 72 verifyResult(result); |
72 result.onsuccess = addMore; | 73 result.onsuccess = addMore; |
73 result.onerror = unexpectedErrorCallback; | 74 result.onerror = unexpectedErrorCallback; |
74 } | 75 } |
75 | 76 |
76 function addMore() | 77 function addMore() |
77 { | 78 { |
78 verifySuccessEvent(event); | 79 verifySuccessEvent(event); |
79 | 80 |
80 result = evalAndLog("event.source.add({x: 'value2', y: 'zzz2'}, 'key2')"); | 81 result = evalAndLog("event.source.add({x: 'value2', y: 'zzz2', z: 2.71}, 'ke
y2')"); |
81 verifyResult(result); | 82 verifyResult(result); |
82 result.onsuccess = getData; | 83 result.onsuccess = getData; |
83 result.onerror = unexpectedErrorCallback; | 84 result.onerror = unexpectedErrorCallback; |
84 } | 85 } |
85 | 86 |
86 function getData() | 87 function getData() |
87 { | 88 { |
88 verifySuccessEvent(event); | 89 verifySuccessEvent(event); |
89 | 90 |
90 result = evalAndLog("indexObject.getKey('value')"); | 91 result = evalAndLog("indexObject.getKey('value')"); |
(...skipping 11 matching lines...) Expand all Loading... |
102 verifyResult(result); | 103 verifyResult(result); |
103 result.onsuccess = getObjectData2; | 104 result.onsuccess = getObjectData2; |
104 result.onerror = unexpectedErrorCallback; | 105 result.onerror = unexpectedErrorCallback; |
105 } | 106 } |
106 | 107 |
107 function getObjectData2() | 108 function getObjectData2() |
108 { | 109 { |
109 verifySuccessEvent(event); | 110 verifySuccessEvent(event); |
110 shouldBeEqualToString("event.result", "key"); | 111 shouldBeEqualToString("event.result", "key"); |
111 | 112 |
| 113 result = evalAndLog("indexObject3.get(2.71)"); |
| 114 verifyResult(result); |
| 115 result.onsuccess = getObjectData3; |
| 116 result.onerror = unexpectedErrorCallback; |
| 117 } |
| 118 |
| 119 function getObjectData3() |
| 120 { |
| 121 verifySuccessEvent(event); |
| 122 shouldBeEqualToString("event.result.x", "value2"); |
| 123 |
112 result = evalAndLog("indexObject.get('value')"); | 124 result = evalAndLog("indexObject.get('value')"); |
113 verifyResult(result); | 125 verifyResult(result); |
114 result.onsuccess = getDataFail; | 126 result.onsuccess = getDataFail; |
115 result.onerror = unexpectedErrorCallback; | 127 result.onerror = unexpectedErrorCallback; |
116 } | 128 } |
117 | 129 |
118 function getDataFail() | 130 function getDataFail() |
119 { | 131 { |
120 verifySuccessEvent(event); | 132 verifySuccessEvent(event); |
121 shouldBeEqualToString("event.result.x", "value"); | 133 shouldBeEqualToString("event.result.x", "value"); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 done(); | 249 done(); |
238 } | 250 } |
239 | 251 |
240 test(); | 252 test(); |
241 | 253 |
242 var successfullyParsed = true; | 254 var successfullyParsed = true; |
243 | 255 |
244 </script> | 256 </script> |
245 </body> | 257 </body> |
246 </html> | 258 </html> |
OLD | NEW |