blob: f9a8b67b693c1b843cd16366ecdaf206c866000b [file] [log] [blame]
Test IndexedDB keyPath with intrinsic properties
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)
store = db.createObjectStore('store', {keyPath: 'id'})
store.createIndex('string length', 'string.length')
store.createIndex('array length', 'array.length')
testKeyPaths():
transaction = db.transaction('store', 'readwrite')
store = transaction.objectStore('store')
store.put({"id":"id#0","string":"","array":[]})
store.put({"id":"id#1","string":"xx","array":["x","x","x"]})
store.put({"id":"id#2","string":"xxxx","array":["x","x","x","x","x","x"]})
store.put({"id":"id#3","string":"xxxxxx","array":["x","x","x","x","x","x","x","x","x"]})
store.put({"id":"id#4","string":"xxxxxxxx","array":["x","x","x","x","x","x","x","x","x","x","x","x"]})
request = store.index('string length').openCursor()
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
PASS cursor.key is cursor.value.string.length
request = store.index('array length').openCursor()
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS cursor.key is cursor.value.array.length
PASS successfullyParsed is true
TEST COMPLETE