| Test IndexedDB adding an autoincremented key and retrieving it successfully |
| |
| 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) |
| test = { |
| name: 'inline key; key generator', |
| autoIncrement: true, |
| storedObject: { name: 'Lincoln' }, |
| keyName: 'id', |
| }; |
| objectStore = db.createObjectStore(test.name, { keyPath: test.keyName, autoIncrement: test.autoIncrement }); |
| request = objectStore.add(test.storedObject); |
| id = event.target.result; |
| request = objectStore.get(id); |
| PASS event.target.result.name is test.storedObject.name |
| PASS event.target.result.id is id |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |