1 Test IndexedDB's createObjectStore's various options
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "create-object-store-options.html"
7 indexedDB.deleteDatabase(dbname)
9 db.createObjectStore('a', {keyPath: 'a'})
10 db.createObjectStore('b')
11 db.createObjectStore('c', {autoIncrement: true});
12 trans = db.transaction(['a', 'b'], 'readwrite')
13 PASS trans.mode is "readwrite"
14 trans.objectStore('a').put({'a': 0})
15 Expecting TypeError exception from db.createObjectStore('d', 'bar');
16 PASS Exception was thrown.
17 PASS db.createObjectStore('d', 'bar'); threw TypeError: Failed to execute 'createObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object.
18 Expecting TypeError exception from db.createObjectStore('e', false);
19 PASS Exception was thrown.
20 PASS db.createObjectStore('e', false); threw TypeError: Failed to execute 'createObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object.
21 trans.objectStore('b').put({'a': 0}, 0)
22 trans.objectStore('a').get(0)
23 PASS event.target.result.a is {a: 0}
24 trans.objectStore('b').get(0)
25 PASS event.target.result.a is {a: 0}
26 PASS successfullyParsed is true