1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 07:57:46 +00:00
serenity/Tests/LibWeb/Text/input/UIEvents/custom-keyboard-event.html

22 lines
830 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
println(`${testCounter}. ${JSON.stringify(part())}`);
testCounter++;
}
// 1. Creating a KeyboardEvent
testPart(() => new KeyboardEvent('keydown', { key: 'W' }).key);
// 2. Creating a KeyboardEvent with modifier
testPart(() => new KeyboardEvent('keydown', { altKey: true }).getModifierState('Alt'));
// 3. Creating a KeyboardEvent with modifier
testPart(() => new KeyboardEvent('keydown', { modifierFnLock: true }).getModifierState('FnLock'));
// 4. Creating a KeyboardEvent with modifier
testPart(() => new KeyboardEvent('keydown', { modifierHyper: true }).getModifierState('Hyper'));
});
</script>