blob: a80ec2b5a3d5557f026b415ae1cb0e5037f00a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import test from "ava";
import { IDBVersionChangeEvent } from "../idbtypes.js";
import { createdb } from "./wptsupport.js";
test("WPT test value.htm, array", (t) => {
return new Promise((resolve, reject) => {
const value = new Array();
const _instanceof = Array;
t.plan(1);
createdb(t).onupgradeneeded = function (e: IDBVersionChangeEvent) {
(e.target as any).result.createObjectStore("store").add(value, 1);
(e.target as any).onsuccess = (e: any) => {
console.log("in first onsuccess");
e.target.result
.transaction("store")
.objectStore("store")
.get(1).onsuccess = (e: any) => {
t.assert(e.target.result instanceof _instanceof, "instanceof");
resolve();
};
};
};
});
});
test("WPT test value.htm, date", (t) => {
return new Promise((resolve, reject) => {
const value = new Date();
const _instanceof = Date;
t.plan(1);
createdb(t).onupgradeneeded = function (e: IDBVersionChangeEvent) {
(e.target as any).result.createObjectStore("store").add(value, 1);
(e.target as any).onsuccess = (e: any) => {
console.log("in first onsuccess");
e.target.result
.transaction("store")
.objectStore("store")
.get(1).onsuccess = (e: any) => {
console.log("target", e.target);
console.log("result", e.target.result);
t.assert(e.target.result instanceof _instanceof, "instanceof");
resolve();
};
};
};
});
});
|