Skip to content

Commit

Permalink
IndexedDB: Tests for [SameObject] assertions in spec WebIDL
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Oct 11, 2017
1 parent 3b3f7fe commit 34938ac
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
15 changes: 15 additions & 0 deletions IndexedDB/globalscope-indexedDB-SameObject.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: Verify [SameObject] behavior of the global scope's indexedDB attribute</title>
<meta name="help" href="https://w3c.github.io/IndexedDB/#dom-windoworworkerglobalscope-indexeddb">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

test(t => {
assert_equals(self.indexedDB, self.indexedDB,
'Attribute should yield the same object each time');

}, 'indexedDB is [SameObject]');

</script>
28 changes: 28 additions & 0 deletions IndexedDB/idbindex-objectStore-SameObject.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: Verify [SameObject] behavior of IDBIndex's objectStore attribute</title>
<meta name="help" href="https://w3c.github.io/IndexedDB/#dom-idbindex-objectstore">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>

indexeddb_test(
(t, db) => {
const store = db.createObjectStore('store');
const index = store.createIndex('index', 'keyPath');
assert_equals(index.objectStore, index.objectStore,
'Attribute should yield the same object each time');

},
(t, db) => {
const tx = db.transaction('store');
const store = tx.objectStore('store');
const index = store.index('index');
assert_equals(index.objectStore, index.objectStore,
'Attribute should yield the same object each time');
t.done();
},
'IDBIndex.objectStore [SameObject]'
);
</script>
26 changes: 26 additions & 0 deletions IndexedDB/idbobjectstore-transaction-SameObject.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: Verify [SameObject] behavior of IDBObjectStore's transaction attribute</title>
<meta name="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-transaction">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>

indexeddb_test(
(t, db) => {
const store = db.createObjectStore('store');
assert_equals(store.transaction, store.transaction,
'Attribute should yield the same object each time');

},
(t, db) => {
const tx = db.transaction('store');
const store = tx.objectStore('store');
assert_equals(store.transaction, store.transaction,
'Attribute should yield the same object each time');
t.done();
},
'IDBObjectStore.transaction [SameObject]'
);
</script>
24 changes: 24 additions & 0 deletions IndexedDB/idbtransaction-db-SameObject.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: Verify [SameObject] behavior of IDBTransaction's db attribute</title>
<meta name="help" href="https://w3c.github.io/IndexedDB/#dom-idbtransaction-db">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>

indexeddb_test(
(t, db, tx) => {
const store = db.createObjectStore('store');
assert_equals(tx.db, tx.db,
'Attribute should yield the same object each time');
},
(t, db) => {
const tx = db.transaction('store');
assert_equals(tx.db, tx.db,
'Attribute should yield the same object each time');
t.done();
},
'IDBTransaction.db [SameObject]'
);
</script>

0 comments on commit 34938ac

Please sign in to comment.