OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>InputEvent Constructor Tests</title> | 2 <title>InputEvent Constructor Tests</title> |
3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 test(function() { | 6 test(function() { |
7 var e = new InputEvent('type'); | 7 var e = new InputEvent('type'); |
8 assert_equals(e.data, null); | 8 assert_equals(e.data, null); |
9 assert_false(e.isComposing); | 9 assert_false(e.isComposing); |
10 }, 'InputEvent constructor without InputEventInit.'); | 10 }, 'InputEvent constructor without InputEventInit.'); |
11 | 11 |
12 test(function() { | 12 test(function() { |
13 var e = new InputEvent('type', { data: null, isComposing: true }); | 13 var e = new InputEvent('type', { data: null, isComposing: true }); |
14 assert_equals(e.data, null); | 14 assert_equals(e.data, null); |
15 assert_true(e.isComposing); | 15 assert_true(e.isComposing); |
16 }, 'InputEvent construtor with InputEventInit where data is null'); | 16 }, 'InputEvent construtor with InputEventInit where data is null'); |
17 | 17 |
18 test(function() { | 18 test(function() { |
19 assert_equals(new InputEvent('type', { data: ''}).data, ''); | 19 assert_equals(new InputEvent('type', { data: ''}).data, ''); |
20 }, 'InputEvent construtor with InputEventInit where data is empty string'); | 20 }, 'InputEvent construtor with InputEventInit where data is empty string'); |
21 | 21 |
22 test(function() { | 22 test(function() { |
23 assert_equals(new InputEvent('type', { data: 'data' }).data, 'data'); | 23 assert_equals(new InputEvent('type', { data: 'data' }).data, 'data'); |
24 }, 'InputEvent construtor with InputEventInit where data is non empty string'); | 24 }, 'InputEvent construtor with InputEventInit where data is non empty string'); |
| 25 |
| 26 test(function() { |
| 27 const range = new StaticRange(); |
| 28 range.setEnd(document, 1); |
| 29 const resultRange = new InputEvent('type', { targetRanges: [range] }).getTarge
tRanges()[0]; |
| 30 assert_equals(resultRange.startContainer, document); |
| 31 assert_equals(resultRange.startOffset, 0); |
| 32 assert_equals(resultRange.endContainer, document); |
| 33 assert_equals(resultRange.endOffset, 1); |
| 34 }, 'InputEvent construtor with InputEventInit where targetRanges is non empty li
st'); |
25 </script> | 35 </script> |
OLD | NEW |