blob: 34edde3a31d91260fb15178ee20c216a42db363e [file] [log] [blame]
Test IndexedDB's index cursors
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "object-cursors.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
autoIncrement = false;
objectStore = db.createObjectStore('a', { keyPath: 'id', autoIncrement: autoIncrement });
objectStore.createIndex(indexes[j].name, 'name', indexes[j].options);
objectStore.createIndex(indexes[j].name, 'name', indexes[j].options);
data = { name: 'Ben', id: 1 };
request = objectStore.add(data);
index = objectStore.index(indexes[j].name);
request = index.openCursor();
index = objectStore.index(indexes[j].name);
request = index.openCursor();
PASS event.target.result.value.name is 'Ben'
PASS event.target.result.value.name is 'Ben'
autoIncrement = true;
objectStore = db.createObjectStore('b', { keyPath: 'id', autoIncrement: autoIncrement });
objectStore.createIndex(indexes[j].name, 'name', indexes[j].options);
objectStore.createIndex(indexes[j].name, 'name', indexes[j].options);
data = { name: 'Ben' };
request = objectStore.add(data);
index = objectStore.index(indexes[j].name);
request = index.openCursor();
index = objectStore.index(indexes[j].name);
request = index.openCursor();
PASS event.target.result.value.name is 'Ben'
PASS event.target.result.value.name is 'Ben'
PASS successfullyParsed is true
TEST COMPLETE