From f399ffd0ac6a74eafa1a60ebc9b5c6328e1f3019 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 6 Apr 2022 12:18:52 +0100 Subject: [PATCH] fix rootElement when running in /tests --- addon/components/dialog.ts | 4 ++-- index.js | 12 ------------ package.json | 2 +- yarn.lock | 10 +++++++++- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/addon/components/dialog.ts b/addon/components/dialog.ts index 8bf7684..33cfdd6 100644 --- a/addon/components/dialog.ts +++ b/addon/components/dialog.ts @@ -4,7 +4,7 @@ import { guidFor } from '@ember/object/internals'; import { inject as service } from '@ember/service'; import { typeOf } from '@ember/utils'; -import { getOwnConfig } from '@embroider/macros'; +import config from 'ember-get-config'; import { Keys } from 'ember-headlessui/utils/keyboard'; import { modifier } from 'ember-modifier'; @@ -18,7 +18,7 @@ import type DialogStackProvider from 'ember-headlessui/services/dialog-stack-pro * @private */ export function getPortalRoot() { - const { rootElement } = getOwnConfig(); + const { APP: { rootElement } } = config; // If we looked up a `rootElement` config at build-time, use that; otherwise use the body return rootElement ? document.querySelector(rootElement) : document.body; diff --git a/index.js b/index.js index 5de90c9..0ca063d 100644 --- a/index.js +++ b/index.js @@ -2,16 +2,4 @@ module.exports = { name: require('./package').name, - - options: { - '@embroider/macros': { - setOwnConfig: {}, - }, - }, - - config(_emberEnv, config) { - // Pass `rootElement` config into a location where it can be looked up at run-time - this.options['@embroider/macros'].setOwnConfig.rootElement = - config.APP.rootElement; - }, }; diff --git a/package.json b/package.json index 0a9eef3..bb28dbe 100644 --- a/package.json +++ b/package.json @@ -36,13 +36,13 @@ }, "dependencies": { "@ember/render-modifiers": "^2.0.0", - "@embroider/macros": "^1.2.0", "ember-auto-import": "^2.2.0", "ember-cli-babel": "^7.26.3", "ember-cli-htmlbars": "^6.0.1", "ember-cli-typescript": "^4.2.1", "ember-concurrency": "^2.1.2", "ember-element-helper": "^0.6.0", + "ember-get-config": "^1.0.4", "ember-modifier": "^3.0.0", "ember-set-helper": "^2.0.1", "ember-truth-helpers": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index 8d9bb83..c5b2301 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1872,7 +1872,7 @@ walk-sync "^3.0.0" wrap-legacy-hbs-plugin-if-needed "^1.0.1" -"@embroider/macros@1.2.0", "@embroider/macros@^1.2.0": +"@embroider/macros@1.2.0", "@embroider/macros@^0.50.0 || ^1.0.0", "@embroider/macros@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@embroider/macros/-/macros-1.2.0.tgz#9a2d99225fba6dcb69e795cddad9f4948c2a2b6b" integrity sha512-WD2V3OKXZB73OymI/zC2+MbqIYaAskhjtSOVVY6yG6kWILyVsJ6+fcbNHEnZyGqs4sm0TvHVJfevmA2OXV8Pww== @@ -6601,6 +6601,14 @@ ember-export-application-global@^2.0.1: resolved "https://registry.yarnpkg.com/ember-export-application-global/-/ember-export-application-global-2.0.1.tgz#b120a70e322ab208defc9e2daebe8d0dfc2dcd46" integrity sha512-B7wiurPgsxsSGzJuPFkpBWnaeuCu2PGpG2BjyrfA1VcL7//o+5RSnZqiCEY326y7qmxb2GoCgo0ft03KBU0rRw== +ember-get-config@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/ember-get-config/-/ember-get-config-1.0.4.tgz#e8c36b0937767ead32e16d157fabd8178c542587" + integrity sha512-WOnf1E0ceRHWy7apnmUFbKcJm2c3KOg4rNNUKNtBFCFp770tOTwv5LAYcqV4+HootPCsQYL7oFUd/0JLiZpMeg== + dependencies: + "@embroider/macros" "^0.50.0 || ^1.0.0" + ember-cli-babel "^7.26.6" + ember-load-initializers@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ember-load-initializers/-/ember-load-initializers-2.1.2.tgz#8a47a656c1f64f9b10cecdb4e22a9d52ad9c7efa"