1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-20 01:46:15 -04:00
elinks/test/ecmascript/assert/keyboardEvent.html
Witold Filipczyk 8a2e85b73f [dom] keyCodes like in Firefox
KeyboardEvent.keyCode returns 0 in Firefox for test case.
I won't change the test, because elinks relies on libdom API.
2024-05-12 16:51:04 +02:00

18 lines
572 B
HTML

<script>
var e = new KeyboardEvent('keydown', { cancelable: true, key: "Enter" });
console.error('keyboardEvent.html');
console.assert(e.cancelable, 'cancelable true');
console.assert(!e.defaultPrevented, 'false');
e.preventDefault();
console.assert(e.defaultPrevented, 'true');
console.assert(e.type === 'keydown', 'keydown');
console.assert(e.key === 'Enter', 'key Enter');
console.assert(e.keyCode === 13, 'ENTER = 13');
var e = new KeyboardEvent('keydown', { cancelable: true, key: "F12" });
console.assert(e.keyCode === 123, e.keyCode);
console.exit(0);
</script>