From 2f3fe4d959c13c86d40f7284a905ba8e47e1d793 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Wed, 7 Aug 2024 17:32:41 +0100 Subject: [PATCH] use consistent BasicDropdownWormhole behaviour in tests --- .../src/components/basic-dropdown-wormhole.ts | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/ember-basic-dropdown/src/components/basic-dropdown-wormhole.ts b/ember-basic-dropdown/src/components/basic-dropdown-wormhole.ts index 6a05a3b2..a56a9d66 100644 --- a/ember-basic-dropdown/src/components/basic-dropdown-wormhole.ts +++ b/ember-basic-dropdown/src/components/basic-dropdown-wormhole.ts @@ -7,27 +7,13 @@ export interface BasicDropdownWormholeSignature { export default class BasicDropdownWormholeComponent extends Component { get getDestinationId(): string { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore + // @ts-expect-error resolveRegistration not typed const config = getOwner(this).resolveRegistration('config:environment') as { - environment: string; - APP: { - rootElement: string; - }; - 'ember-basic-dropdown': { - destination: string; + 'ember-basic-dropdown'?: { + destination?: string; }; }; - if (config.environment === 'test') { - // document doesn't exists in fastboot apps, for this reason we need this check - if (typeof document === 'undefined') { - return ''; - } - const rootElement = config['APP']?.rootElement; - return document.querySelector(rootElement)?.id ?? ''; - } - return ((config['ember-basic-dropdown'] && config['ember-basic-dropdown'].destination) || 'ember-basic-dropdown-wormhole') as string;