1
0
Fork 0
firefox/testing/web-platform/tests/IndexedDB/idbindex_indexNames.any.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

27 lines
857 B
JavaScript

// META: global=window,worker
// META: title=IDBObjectStore.indexNames
// META: script=resources/support.js
'use_strict';
async_test(t => {
let db;
const open_rq = createdb(t);
open_rq.onupgradeneeded = t.step_func(e => {
db = e.target.result;
const objStore = db.createObjectStore('test', {keyPath: 'key'});
objStore.createIndex('index', 'data');
assert_equals(objStore.indexNames[0], 'index', 'indexNames');
assert_equals(objStore.indexNames.length, 1, 'indexNames.length');
});
open_rq.onsuccess = t.step_func(e => {
const objStore = db.transaction('test', 'readonly').objectStore('test');
assert_equals(objStore.indexNames[0], 'index', 'indexNames (second)');
assert_equals(objStore.indexNames.length, 1, 'indexNames.length (second)');
t.done();
});
}, 'Verify IDBObjectStore.indexNames property');