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
63
64
65
66
67
|
<!DOCTYPE html>
<meta charset=utf-8>
<title>IDBKeyRange Tests</title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=support.js></script>
<script>
// only
test( function() {
var keyRange = IDBKeyRange.only(1);
assert_true(keyRange instanceof IDBKeyRange, "keyRange instanceof IDBKeyRange");
assert_equals(keyRange.lower, 1, "keyRange");
assert_equals(keyRange.upper, 1, "keyRange");
assert_false(keyRange.lowerOpen, "keyRange.lowerOpen");
assert_false(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.only() - returns an IDBKeyRange and the properties are set correctly");
// lowerBound
test( function() {
var keyRange = IDBKeyRange.lowerBound(1, true)
assert_true(keyRange instanceof IDBKeyRange, "keyRange instanceof IDBKeyRange");
assert_equals(keyRange.lower, 1, "keyRange.lower");
assert_equals(keyRange.upper, undefined, "keyRange.upper");
assert_true(keyRange.lowerOpen, "keyRange.lowerOpen");
assert_true(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.lowerBound() - returns an IDBKeyRange and the properties are set correctly");
test( function() {
var keyRange = IDBKeyRange.lowerBound(1);
assert_false(keyRange.lowerOpen, "keyRange.lowerOpen");
}, "IDBKeyRange.lowerBound() - 'open' parameter has correct default set");
// upperBound
test( function() {
var keyRange = IDBKeyRange.upperBound(1, true);
assert_true(keyRange instanceof IDBKeyRange, "keyRange instanceof IDBKeyRange");
assert_equals(keyRange.lower, undefined, "keyRange.lower");
assert_equals(keyRange.upper, 1, "keyRange.upper");
assert_true(keyRange.lowerOpen, "keyRange.lowerOpen");
assert_true(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.upperBound() - returns an IDBKeyRange and the properties are set correctly");
test( function() {
var keyRange = IDBKeyRange.upperBound(1);
assert_false(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.upperBound() - 'open' parameter has correct default set");
// bound
test( function() {
var keyRange = IDBKeyRange.bound(1, 2, true, true);
assert_true(keyRange instanceof IDBKeyRange, "keyRange instanceof IDBKeyRange");
assert_equals(keyRange.lower, 1, "keyRange");
assert_equals(keyRange.upper, 2, "keyRange");
assert_true(keyRange.lowerOpen, "keyRange.lowerOpen");
assert_true(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.bound() - returns an IDBKeyRange and the properties are set correctly");
test( function() {
var keyRange = IDBKeyRange.bound(1, 2);
assert_false(keyRange.lowerOpen, "keyRange.lowerOpen");
assert_false(keyRange.upperOpen, "keyRange.upperOpen");
}, "IDBKeyRange.bound() - 'lowerOpen' and 'upperOpen' parameters have correct defaults set");
</script>
<div id=log></div>
|