forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeyboard-map-https.html
30 lines (26 loc) · 935 Bytes
/
keyboard-map-https.html
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Keyboard Map basic tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_true(navigator.keyboard instanceof Keyboard);
}, "navigator.keyboard instanceof Keyboard");
test(function() {
assert_equals(navigator.keyboard, navigator.keyboard);
}, "navigator.keyboard SameObject");
promise_test(function() {
const p = navigator.keyboard.getLayoutMap();
assert_true(p instanceof Promise);
return p.then(function(map) {
assert_true(map instanceof KeyboardLayoutMap);
for (var [k,v] of map) {
assert_true(typeof k === 'string');
assert_true(k.length != 0);
assert_true(typeof v === 'string');
assert_true(v.length != 0);
}
});
}, "navigator.keyboard.getLayoutMap() returns a Promise<KeyboardLayoutMap> when successful");
</script>