42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
Test IndexedDB key comparison
|
|
|
|
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('foo');
|
|
date1 = new Date(1000);
|
|
request = objectStore.add([], date1);
|
|
date0 = new Date(0);
|
|
request = objectStore.add([], date0);
|
|
date3 = new Date(3000);
|
|
request = objectStore.add([], date3);
|
|
date2 = new Date(2000);
|
|
request = objectStore.add([], date2);
|
|
sortedKeys = [date0.toString(), date1.toString(), date2.toString(), date3.toString()];
|
|
request = objectStore.openCursor();
|
|
cursor = event.target.result;
|
|
PASS cursor.key.toString() is sortedKeys[keyIndex]
|
|
cursor.continue();
|
|
keyIndex++;
|
|
cursor = event.target.result;
|
|
PASS cursor.key.toString() is sortedKeys[keyIndex]
|
|
cursor.continue();
|
|
keyIndex++;
|
|
cursor = event.target.result;
|
|
PASS cursor.key.toString() is sortedKeys[keyIndex]
|
|
cursor.continue();
|
|
keyIndex++;
|
|
cursor = event.target.result;
|
|
PASS cursor.key.toString() is sortedKeys[keyIndex]
|
|
cursor.continue();
|
|
keyIndex++;
|
|
cursor = event.target.result;
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|