Skip to content

Commit

Permalink
refactor(core): Add four tests and fix code to make tests pass.
Browse files Browse the repository at this point in the history
The first test asserts that bubbling does not work right now.

The second asserts that stopPropagation works, which should pass when test #1 passes too.

The third test asserts properties about the events passed to the event handler.

THe fourth test asserts that mouse events do not translate to jsaction nor help emit the jsaction binary. This required a change in code to make this pass.
  • Loading branch information
iteriani committed May 10, 2024
1 parent 28fb385 commit 0b589ed
Show file tree
Hide file tree
Showing 3 changed files with 341 additions and 230 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/hydration/event_replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ export function collectDomEventsInfo(
continue;
}
const name: string = firstParam;
if (
name === 'mouseenter' ||
name === 'mouseleave' ||
name === 'pointerenter' ||
name === 'pointerleave'
) {
continue;
}
eventTypesToReplay.add(name);
const listenerElement = unwrapRNode(lView[secondParam]) as any as Element;
i++; // move the cursor to the next position (location of the listener idx)
Expand Down
8 changes: 0 additions & 8 deletions packages/platform-server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ function insertEventRecordScript(
const captureEventTypes = [];
const eventTypes = [];
for (const eventType of events) {
if (
eventType === 'mouseenter' ||
eventType === 'mouseleave' ||
eventType === 'pointerenter' ||
eventType === 'pointerleave'
) {
continue;
}
if (
eventType === 'focus' ||
eventType === 'blur' ||
Expand Down

0 comments on commit 0b589ed

Please sign in to comment.