Skip to content

Commit

Permalink
first try to serialize form
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Civitillo authored and rmorshea committed Nov 30, 2022
1 parent 4fd5cde commit 51ba383
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/client/packages/idom-client-react/src/event-to-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ const elementTransformCategories = {
return {};
}
},
hasElements: (element) => {
const result = {};
Object.keys(element).forEach((key) => {
result[key] = serializeDomElement(element.elements[key])
});
return result;
}
};

function defaultElementTransform(element) {
Expand All @@ -69,6 +76,7 @@ const elementTagCategories = {
],
hasCurrentTime: ["AUDIO", "VIDEO"],
hasFiles: ["INPUT"],
hasElements: ["FORM"],
};

const elementTransforms = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const allTargetData = {
tagName,
output: { target: { currentTime: allTargetData.currentTime } },
})),
...["FORM"].map((tagName) => ({
case: `adds 'value' attribute for ${tagName} element`,
tagName,
output: { target: { value: allTargetData.value } },
})),
].forEach((expectation) => {
test(`serializeEvent() ${expectation.case}`, () => {
const eventData = {
Expand Down Expand Up @@ -113,6 +118,7 @@ const allEventData = {
clientX: "clientX",
clientY: "clientY",
ctrlKey: "ctrlKey",
form: "form",
metaKey: "metaKey",
pageX: "pageX",
pageY: "pageY",
Expand Down

0 comments on commit 51ba383

Please sign in to comment.