diff --git a/addon-test-support/@ember/test-helpers/dom/click.ts b/addon-test-support/@ember/test-helpers/dom/click.ts index ba506e155..372c7ef88 100644 --- a/addon-test-support/@ember/test-helpers/dom/click.ts +++ b/addon-test-support/@ember/test-helpers/dom/click.ts @@ -33,6 +33,7 @@ export function __click__( element: Element | Document | Window, options: MouseEventInit ): void { + options = { ...options, detail: 1 }; let mouseDownEvent = fireEvent(element, 'mousedown', options); if (!isWindow(element) && !mouseDownEvent?.defaultPrevented) { diff --git a/addon-test-support/@ember/test-helpers/dom/double-click.ts b/addon-test-support/@ember/test-helpers/dom/double-click.ts index 4a74bbefd..84dd960a9 100644 --- a/addon-test-support/@ember/test-helpers/dom/double-click.ts +++ b/addon-test-support/@ember/test-helpers/dom/double-click.ts @@ -22,6 +22,7 @@ export function __doubleClick__( element: Element | Document | Window, options: MouseEventInit ): void { + options = { ...options, detail: 1 }; let mouseDownEvent = fireEvent(element, 'mousedown', options); if (!isWindow(element) && !mouseDownEvent?.defaultPrevented) { @@ -30,6 +31,8 @@ export function __doubleClick__( fireEvent(element, 'mouseup', options); fireEvent(element, 'click', options); + + options = { ...options, detail: 2 }; fireEvent(element, 'mousedown', options); fireEvent(element, 'mouseup', options); fireEvent(element, 'click', options); diff --git a/tests/unit/dom/click-test.js b/tests/unit/dom/click-test.js index f72cd8922..ba02016a5 100644 --- a/tests/unit/dom/click-test.js +++ b/tests/unit/dom/click-test.js @@ -142,14 +142,15 @@ module('DOM Helper: click', function (hooks) { 'clientY', 'button', 'buttons', + 'detail', ]); await click(element, { clientX: 13, clientY: 17, button: 2 }); assert.verifySteps([ - 'mousedown 13 17 2 1', - 'mouseup 13 17 2 1', - 'click 13 17 2 1', + 'mousedown 13 17 2 1 1', + 'mouseup 13 17 2 1 1', + 'click 13 17 2 1 1', ]); }); diff --git a/tests/unit/dom/double-click-test.js b/tests/unit/dom/double-click-test.js index 36a84881c..7ece84831 100644 --- a/tests/unit/dom/double-click-test.js +++ b/tests/unit/dom/double-click-test.js @@ -185,18 +185,19 @@ module('DOM Helper: doubleClick', function (hooks) { 'clientY', 'button', 'buttons', + 'detail', ]); await doubleClick(element, { clientX: 13, clientY: 17, button: 1 }); assert.verifySteps([ - 'mousedown 13 17 1 1', - 'mouseup 13 17 1 1', - 'click 13 17 1 1', - 'mousedown 13 17 1 1', - 'mouseup 13 17 1 1', - 'click 13 17 1 1', - 'dblclick 13 17 1 1', + 'mousedown 13 17 1 1 1', + 'mouseup 13 17 1 1 1', + 'click 13 17 1 1 1', + 'mousedown 13 17 1 1 2', + 'mouseup 13 17 1 1 2', + 'click 13 17 1 1 2', + 'dblclick 13 17 1 1 2', ]); }); });