summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/uievents/constructors/inputevent-constructor.html
blob: 3876abcd430e3f2dbdc58e57d8f179721a67cc77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<title>InputEvent Constructor Tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
  var e = new InputEvent('type');
  assert_equals(e.data, null, '.data');
  assert_false(e.isComposing, '.isComposing');
}, 'InputEvent constructor without InputEventInit.');

test(function() {
  var e = new InputEvent('type', { data: null, isComposing: true });
  assert_equals(e.data, null, '.data');
  assert_true(e.isComposing, '.isComposing');
}, 'InputEvent construtor with InputEventInit where data is null');

test(function() {
  assert_equals(new InputEvent('type', { data: ''}).data, '', '.data');
}, 'InputEvent construtor with InputEventInit where data is empty string');

test(function() {
  assert_equals(new InputEvent('type', { data: 'data' }).data, 'data', '.data');
}, 'InputEvent construtor with InputEventInit where data is non empty string');
</script>