blob: 0a5cd9182f501999b2f4d712717fcca70c4c5e21 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Testing keydown with DomKey Cut, Copy and Paste</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<input type="text" id="txt">
<script>
test(function() {
assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.');
const txt = document.getElementById('txt');
// Cut and Paste.
txt.value = 'abc';
txt.select();
eventSender.keyDown('Cut');
assert_equals(txt.value, '', 'Cut should delete selection');
eventSender.keyDown('Paste');
assert_equals(txt.value, 'abc', 'Should Paste Cut text');
// Copy and Paste.
txt.value = '123';
txt.select();
eventSender.keyDown('Copy');
assert_equals(txt.value, '123', 'Copy shouldn\'t modify selection');
eventSender.keyDown('Paste');
eventSender.keyDown('Paste');
assert_equals(txt.value, '123123', 'Should Paste twice');
}, "DomKey Cut, Copy and Paste should trigger corresponding edit actions");
</script>
</body>
</html>