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
52
53
54
55
56
57
58
59
60
61
62
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test for DOM StorageEvent</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
const kTests = [
{ createEventArg: "StorageEvent",
type: "aaa", bubbles: true, cancelable: true,
key: null, oldValue: 'a', newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "storageevent",
type: "bbb", bubbles: false, cancelable: true,
key: 'key', oldValue: null, newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "Storageevent",
type: "ccc", bubbles: true, cancelable: false,
key: 'key', oldValue: 'a', newValue: null, url: 'c', storageArea: null },
{ createEventArg: "storageEvent",
type: "ddd", bubbles: false, cancelable: false,
key: 'key', oldValue: 'a', newValue: 'b', url: null, storageArea: null },
{ createEventArg: "StorageEvent",
type: "eee", bubbles: true, cancelable: true,
key: 'key', oldValue: 'a', newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "storageevent",
type: "fff", bubbles: false, cancelable: true,
key: null, oldValue: null, newValue: null, url: null, storageArea: null },
];
for (var i = 0; i < kTests.length; i++) {
var description = "test, Index: " + i + ", ";
const kTest = kTests[i];
var e = document.createEvent(kTest.createEventArg);
e.initStorageEvent(kTest.type, kTest.bubbles, kTest.cancelable,
kTest.key, kTest.oldValue, kTest.newValue, kTest.url,
kTest.storageArea);
for (var attr in kTest) {
if (attr == 'createEventArg')
continue;
is(e[attr], kTest[attr], description + attr + " returns wrong value");
}
is(e.isTrusted, false, description + "isTrusted returns wrong value");
}
</script>
</pre>
</body>
</html>
|