Skip to content

Commit d9a7880

Browse files
committed
fix(cdk/testing): fake touch event does not touch identifier
The fake `TouchEvent` being created by test harnesses for the TestBed harness environment currently set an id for a `Touch` of the fake event. The `Touch` currently incorrectly sets the unique touch id to a field named `id`, while it should be `identifier`.
1 parent be76dc8 commit d9a7880

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cdk/testing/testbed/fake-events/event-objects.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export function createMouseEvent(
2727
const event = new MouseEvent(type, {
2828
bubbles: true,
2929
cancelable: true,
30+
view: window,
31+
detail: 0,
32+
relatedTarget: null,
3033
screenX,
3134
screenY,
3235
clientX,
@@ -77,7 +80,7 @@ export function createTouchEvent(type: string, pageX = 0, pageY = 0, clientX = 0
7780
// We cannot use the `TouchEvent` or `Touch` because Firefox and Safari lack support.
7881
// TODO: Switch to the constructor API when it is available for Firefox and Safari.
7982
const event = document.createEvent('UIEvent');
80-
const touchDetails = {pageX, pageY, clientX, clientY, id: uniqueIds++};
83+
const touchDetails = {pageX, pageY, clientX, clientY, identifier: uniqueIds++};
8184

8285
// TS3.6 removes the initUIEvent method and suggests porting to "new UIEvent()".
8386
(event as any).initUIEvent(type, true, true, window, 0);

0 commit comments

Comments
 (0)