| Test IndexedDB's IDBObjectStore.delete(IDBKeyRange) method. |
| |
| 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) |
| db.createObjectStore('store') |
| |
| trans = db.transaction('store', 'readwrite') |
| store = trans.objectStore('store') |
| store.put(1,1) |
| store.put(2,2) |
| store.put(3,3) |
| store.put(4,4) |
| store.put(5,5) |
| store.put(6,6) |
| store.put(7,7) |
| store.put(8,8) |
| store.put(9,9) |
| store.put(10,10) |
| store.delete(IDBKeyRange.bound(3, 8, false, false)) |
| getting keys from store... |
| expect: [1,2,9,10] |
| actual: [1,2,9,10] |
| PASS Match! |
| |
| trans = db.transaction('store', 'readwrite') |
| store = trans.objectStore('store') |
| store.put(1,1) |
| store.put(2,2) |
| store.put(3,3) |
| store.put(4,4) |
| store.put(5,5) |
| store.put(6,6) |
| store.put(7,7) |
| store.put(8,8) |
| store.put(9,9) |
| store.put(10,10) |
| store.delete(IDBKeyRange.bound(3, 8, true, false)) |
| getting keys from store... |
| expect: [1,2,3,9,10] |
| actual: [1,2,3,9,10] |
| PASS Match! |
| |
| trans = db.transaction('store', 'readwrite') |
| store = trans.objectStore('store') |
| store.put(1,1) |
| store.put(2,2) |
| store.put(3,3) |
| store.put(4,4) |
| store.put(5,5) |
| store.put(6,6) |
| store.put(7,7) |
| store.put(8,8) |
| store.put(9,9) |
| store.put(10,10) |
| store.delete(IDBKeyRange.bound(3, 8, false, true)) |
| getting keys from store... |
| expect: [1,2,8,9,10] |
| actual: [1,2,8,9,10] |
| PASS Match! |
| |
| trans = db.transaction('store', 'readwrite') |
| store = trans.objectStore('store') |
| store.put(1,1) |
| store.put(2,2) |
| store.put(3,3) |
| store.put(4,4) |
| store.put(5,5) |
| store.put(6,6) |
| store.put(7,7) |
| store.put(8,8) |
| store.put(9,9) |
| store.put(10,10) |
| store.delete(IDBKeyRange.bound(3, 8, true, true)) |
| getting keys from store... |
| expect: [1,2,3,8,9,10] |
| actual: [1,2,3,8,9,10] |
| PASS Match! |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |