blob: 76a617d254db3cf8ff1bc91ed6178f594f304395 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("This tests KeyboardEvent.getModifierState().");
var event = new KeyboardEvent('keydown', { });
shouldBeFalse("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { ctrlKey: true });
shouldBeTrue("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { altKey: true });
shouldBeFalse("event.getModifierState('Control')");
shouldBeTrue("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { shiftKey: true });
shouldBeFalse("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeTrue("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { metaKey: true });
shouldBeFalse("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeTrue("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { modifierAltGraph: true });
shouldBeFalse("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeTrue("event.getModifierState('AltGraph')");
shouldBeFalse("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { modifierCapsLock: true });
shouldBeFalse("event.getModifierState('Control')");
shouldBeFalse("event.getModifierState('Alt')");
shouldBeFalse("event.getModifierState('Shift')");
shouldBeFalse("event.getModifierState('Meta')");
shouldBeFalse("event.getModifierState('AltGraph')");
shouldBeTrue("event.getModifierState('CapsLock')");
var event = new KeyboardEvent('keydown', { ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, modifierAltGraph: true, modifierCapsLock: true });
shouldBeTrue("event.getModifierState('Control')");
shouldBeTrue("event.getModifierState('Alt')");
shouldBeTrue("event.getModifierState('Shift')");
shouldBeTrue("event.getModifierState('Meta')");
shouldBeTrue("event.getModifierState('AltGraph')");
shouldBeTrue("event.getModifierState('CapsLock')");
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>