diff --git a/addons/web/static/tests/helpers/test_utils_dom.js b/addons/web/static/tests/helpers/test_utils_dom.js index f85fe9bec8b..ded399572ee 100644 --- a/addons/web/static/tests/helpers/test_utils_dom.js +++ b/addons/web/static/tests/helpers/test_utils_dom.js @@ -81,17 +81,21 @@ odoo.define('web.test_utils_dom', function (require) { dragover: { constructor: DragEvent, processParameters: onlyBubble }, drop: { constructor: DragEvent, processParameters: onlyBubble }, - touchstart: { constructor: TouchEvent, processParameters: touchEventMapping }, - touchend: { constructor: TouchEvent, processParameters: touchEventMapping }, - touchmove: { constructor: TouchEvent, processParameters: touchEventMapping }, - touchcancel: { constructor: TouchEvent, processParameters: touchEventCancelMapping }, - input: { constructor: InputEvent, processParameters: onlyBubble }, compositionstart: { constructor: CompositionEvent, processParameters: onlyBubble }, compositionend: { constructor: CompositionEvent, processParameters: onlyBubble }, }; + if (typeof TouchEvent === 'function') { + Object.assign(EVENT_TYPES, { + touchstart: {constructor: TouchEvent, processParameters: touchEventMapping}, + touchend: {constructor: TouchEvent, processParameters: touchEventMapping}, + touchmove: {constructor: TouchEvent, processParameters: touchEventMapping}, + touchcancel: {constructor: TouchEvent, processParameters: touchEventCancelMapping}, + }); + } + /** * Check if an object is an instance of EventTarget. *