Skip to content

Commit

Permalink
fix rootElement when running in /tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Apr 6, 2022
1 parent 075fd5b commit f399ffd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions addon/components/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@
walk-sync "^3.0.0"
wrap-legacy-hbs-plugin-if-needed "^1.0.1"

"@embroider/[email protected]", "@embroider/macros@^1.2.0":
"@embroider/[email protected]", "@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==
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f399ffd

Please sign in to comment.