| Test IndexedDB's index cursors |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB; |
| |
| indexedDB.deleteDatabase(dbname) |
| indexedDB.open(dbname) |
| autoIncrement = false; |
| objectStore = db.createObjectStore('a', { keyPath: 'id', autoIncrement: autoIncrement }); |
| objectStore.createIndex(indexes[j].name, 'name', indexes[j].options); |
| objectStore.createIndex(indexes[j].name, 'name', indexes[j].options); |
| data = { name: 'Ben', id: 1 }; |
| request = objectStore.add(data); |
| index = objectStore.index(indexes[j].name); |
| request = index.openCursor(); |
| index = objectStore.index(indexes[j].name); |
| request = index.openCursor(); |
| PASS event.target.result.value.name is 'Ben' |
| PASS event.target.result.value.name is 'Ben' |
| autoIncrement = true; |
| objectStore = db.createObjectStore('b', { keyPath: 'id', autoIncrement: autoIncrement }); |
| objectStore.createIndex(indexes[j].name, 'name', indexes[j].options); |
| objectStore.createIndex(indexes[j].name, 'name', indexes[j].options); |
| data = { name: 'Ben' }; |
| request = objectStore.add(data); |
| index = objectStore.index(indexes[j].name); |
| request = index.openCursor(); |
| index = objectStore.index(indexes[j].name); |
| request = index.openCursor(); |
| PASS event.target.result.value.name is 'Ben' |
| PASS event.target.result.value.name is 'Ben' |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |