From fc70bf7af8f71caf0d8e7fe1133f3dc7cc056605 Mon Sep 17 00:00:00 2001 From: Matthias Goudjil Date: Tue, 9 Jul 2024 23:31:46 +0200 Subject: [PATCH] related #34599 and #35970 - test custom events instead eventEmitter instance --- .../new-theme/js/pages/order/create/product-manager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/admin-dev/themes/new-theme/js/pages/order/create/product-manager.ts b/admin-dev/themes/new-theme/js/pages/order/create/product-manager.ts index 55d76515efd88..eae2e2a2dda5d 100644 --- a/admin-dev/themes/new-theme/js/pages/order/create/product-manager.ts +++ b/admin-dev/themes/new-theme/js/pages/order/create/product-manager.ts @@ -113,9 +113,10 @@ export default class ProductManager { * * @private */ + private onProductSearch(): void { - EventEmitter.on(eventMap.productSearched, (response) => { - this.products = response.products; + document.addEventListener(eventMap.productSearched, (event: any) => { + this.products = event.detail.products; this.productRenderer.renderSearchResults(this.products); this.selectFirstResult(); }); @@ -267,7 +268,7 @@ export default class ProductManager { $searchRequest .then((response) => { - EventEmitter.emit(eventMap.productSearched, response); + document.dispatchEvent(new CustomEvent(eventMap.productSearched, {detail: response})); }) .catch((response: JQuery.jqXHR) => { if (response.statusText === 'abort') {