diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/indexedDB/test/unit/test_autoIncrement_indexes.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/indexedDB/test/unit/test_autoIncrement_indexes.js')
-rw-r--r-- | dom/indexedDB/test/unit/test_autoIncrement_indexes.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_autoIncrement_indexes.js b/dom/indexedDB/test/unit/test_autoIncrement_indexes.js new file mode 100644 index 000000000..ce2d5d552 --- /dev/null +++ b/dom/indexedDB/test/unit/test_autoIncrement_indexes.js @@ -0,0 +1,56 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +var testGenerator = testSteps(); + +function testSteps() +{ + let request = indexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1); + request.onerror = errorHandler; + request.onupgradeneeded = grabEventAndContinueHandler; + let event = yield undefined; + + let db = request.result; + db.onerror = errorHandler; + + let objectStore = db.createObjectStore("foo", { keyPath: "id", + autoIncrement: true }); + objectStore.createIndex("first","first"); + objectStore.createIndex("second","second"); + objectStore.createIndex("third","third"); + + let data = { first: "foo", second: "foo", third: "foo" }; + + objectStore.add(data).onsuccess = grabEventAndContinueHandler; + event = yield undefined; + + is(event.target.result, 1, "Added entry"); + request.onsuccess = grabEventAndContinueHandler; + + event = yield undefined; + + objectStore = db.transaction("foo").objectStore("foo"); + let first = objectStore.index("first"); + let second = objectStore.index("second"); + let third = objectStore.index("third"); + + first.get("foo").onsuccess = grabEventAndContinueHandler; + event = yield undefined; + + is (event.target.result.id, 1, "Entry in first"); + + second.get("foo").onsuccess = grabEventAndContinueHandler; + event = yield undefined; + + is (event.target.result.id, 1, "Entry in second"); + + third.get("foo").onsuccess = grabEventAndContinueHandler; + event = yield undefined; + + is (event.target.result.id, 1, "Entry in third"); + + finishTest(); + yield undefined; +} |