1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:27:35 +00:00

LibWeb: Add missing EventModifierInit fields and getModifierState

This commit is contained in:
Bastiaan van der Plaat 2024-01-19 18:52:45 +01:00 committed by Andreas Kling
parent ba8704243e
commit 9aadc6c8c9
11 changed files with 174 additions and 24 deletions

View file

@ -0,0 +1,4 @@
1. "W"
2. true
3. true
4. true

View file

@ -0,0 +1,22 @@
<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>