Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: Serialize empty InputEventInit data as an empty string #2628

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/LibWeb/UIEvents/InputEvent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface InputEvent : UIEvent {

// https://w3c.github.io/uievents/#dictdef-inputeventinit
dictionary InputEventInit : UIEventInit {
DOMString? data = null;
[LegacyNullToEmptyString] DOMString? data = null;
boolean isComposing = false;
DOMString inputType = "";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Summary

Harness status: OK

Rerun

Found 4 tests

4 Pass
Details
Result Test Name MessagePass InputEvent constructor without InputEventInit.
Pass InputEvent construtor with InputEventInit where data is null
Pass InputEvent construtor with InputEventInit where data is empty string
Pass InputEvent construtor with InputEventInit where data is non empty string
Original file line number Diff line number Diff line change
@@ -0,0 +1,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>
Loading