inputevent-constructor.html (967B)
1 <!DOCTYPE html> 2 <title>InputEvent Constructor Tests</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script> 6 test(function() { 7 var e = new InputEvent('type'); 8 assert_equals(e.data, null, '.data'); 9 assert_false(e.isComposing, '.isComposing'); 10 }, 'InputEvent constructor without InputEventInit.'); 11 12 test(function() { 13 var e = new InputEvent('type', { data: null, isComposing: true }); 14 assert_equals(e.data, null, '.data'); 15 assert_true(e.isComposing, '.isComposing'); 16 }, 'InputEvent construtor with InputEventInit where data is null'); 17 18 test(function() { 19 assert_equals(new InputEvent('type', { data: ''}).data, '', '.data'); 20 }, 'InputEvent construtor with InputEventInit where data is empty string'); 21 22 test(function() { 23 assert_equals(new InputEvent('type', { data: 'data' }).data, 'data', '.data'); 24 }, 'InputEvent construtor with InputEventInit where data is non empty string'); 25 </script>