blob: f285dde0da0921c085ee2c326cdb290d8d73a02b [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 MouseEvent('mousedown', { });
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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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 MouseEvent('mousedown', { 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>