I have service (no view) that depends on DialogService
from aurelia-dialog
, and uses that for opening a dialog. Now I want to test my service. While doing that I got the following error on dialogService.open(...)
.
Error: DialogRenderer must implement getDialogContainer().
at Renderer.getDialogContainer (webpack-internal:///./node_modules/aurelia-dialog/dist/native-modules/renderer.js:14:15)
at DialogService.open (webpack-internal:///./node_modules/aurelia-dialog/dist/native-modules/dialog-service.js:139:106) …
I got the idea that I need to load the plugin aurelia-dialog
before running any of test cases. To this end, I tried the following.
import { bootstrap } from "aurelia-bootstrapper";
import { Aurelia, Container, PLATFORM } from "aurelia-framework";
describe("test specs", () => {
let container: Container;
beforeAll(async () => {
await bootstrap(async (aurelia: Aurelia) => {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin(PLATFORM.moduleName("aurelia-dialog"), (config) => {
config.useDefaults();
config.settings.lock = true;
config.settings.centerHorizontalOnly = false;
config.settings.startingZIndex = 5;
config.settings.keyboard = true;
});
Container.instance = container = new Container();
aurelia.container = container;
await aurelia.start();
});
});
});
But than I got the following error on aurelia.start
.
Error: Loader must implement loadAllModules(ids).
at Loader.loadAllModules (webpack-internal:///./node_modules/aurelia-loader/dist/native-modules/aurelia-loader.js:113:11)
at ViewEngine.importViewResources (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:3593:24)
at eval (webpack-internal:///aurelia-framework:646:23)
at <Jasmine>
at loadResources (webpack-internal:///aurelia-framework:637:7)
at eval (webpack-internal:///aurelia-framework:731:14)
at next (webpack-internal:///aurelia-framework:577:30)
at runTasks (webpack-internal:///aurelia-framework:583:10)
at eval (webpack-internal:///aurelia-framework:936:16)
at <Jasmine>
at eval (webpack-internal:///aurelia-framework:935:21)
at <Jasmine>
at FrameworkConfiguration.apply (webpack-internal:///aurelia-framework:919:42)
at Aurelia.start (webpack-internal:///aurelia-framework:463:37) …
Thus, my question is how to correctly load the aurelia-dialog
plugin in this scenario?