| Test IndexedDB indexes against autoincrementing keys |
| |
| 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) |
| objectStore = db.createObjectStore('autoincrement-id', { keyPath: 'id', autoIncrement: true }); |
| objectStore.createIndex('first', 'first'); |
| objectStore.createIndex('second', 'second'); |
| objectStore.createIndex('third', 'third'); |
| data = { first: 'foo', second: 'foo', third: 'foo' }; |
| request = objectStore.add(data); |
| key = event.target.result; |
| PASS key == null is false |
| expected key is 1 |
| objectStore = db.transaction('autoincrement-id').objectStore('autoincrement-id'); |
| first = objectStore.index('first'); |
| request = first.get('foo'); |
| PASS event.target.result.id is key |
| second = objectStore.index('second'); |
| request = second.get('foo'); |
| PASS event.target.result.id is key |
| third = objectStore.index('third'); |
| request = third.get('foo'); |
| PASS event.target.result.id is key |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |