IndexedDB: Support Array-type key paths
[WebKit-https.git] / LayoutTests / storage / indexeddb / keypath-arrays-expected.txt
1 Test IndexedDB Array-type keyPaths
2
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
7
8 indexedDB.deleteDatabase('keypath-arrays')
9 indexedDB.open('keypath-arrays')
10
11 openSuccess():
12 db = event.target.result
13 request = db.setVersion('1')
14 store = db.createObjectStore('store', {keyPath: ['a', 'b']})
15 store.createIndex('index', ['c', 'd'])
16 Expecting exception from db.createObjectStore('store-with-generator', {keyPath: ['a', 'b'], autoIncrement: true})
17 PASS Exception was thrown.
18 PASS code is DOMException.INVALID_ACCESS_ERR
19 Expecting exception from store.createIndex('index-multientry', ['e', 'f'], {multiEntry: true})
20 PASS Exception was thrown.
21 PASS code is DOMException.NOT_SUPPORTED_ERR
22
23 testKeyPaths():
24 transaction = db.transaction(['store'], 'readwrite')
25 store = transaction.objectStore('store')
26 index = store.index('index')
27
28 request = store.put({a: 1, b: 2, c: 3, d: 4})
29 request = store.openCursor()
30 cursor = request.result
31 PASS cursor is non-null.
32 PASS JSON.stringify(cursor.key) is "[1,2]"
33 request = index.openCursor()
34 cursor = request.result
35 PASS cursor is non-null.
36 PASS JSON.stringify(cursor.primaryKey) is "[1,2]"
37 PASS JSON.stringify(cursor.key) is "[3,4]"
38 PASS successfullyParsed is true
39
40 TEST COMPLETE
41