Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
AuthorDetails,
Authors,
Book,
BookDetails,
Books,
Chat,
ChatUser,
ChatUsers,
Login,
LoginSpecial,
Main,
JitHtmlBrowserConfiguration,
RouterConfiguration.customize({ useHref: true }),
DebugConfiguration,
)
.app({
host: document.querySelector('app'),
component: App,
});
await au.start().wait();
})().catch(console.error);
it('can be activated with config object', async function () {
this.timeout(5000);
const { router, tearDown } = await createFixture({ separators: { viewport: '#' } });
assert.strictEqual(router['isActive'], true, `router.isActive`);
assert.strictEqual(router.instructionResolver.separators.viewport, '#', `router.instructionResolver.separators.viewport`);
RouterConfiguration.customize();
await tearDown();
});
async function createFixture(config?) {
const ctx = TestContext.createHTMLTestContext();
const { container, lifecycle } = ctx;
const App = CustomElement.define({ name: 'app', template: '<template></template>' });
const host = ctx.doc.createElement('div');
ctx.doc.body.appendChild(host as any);
const au = new Aurelia(container)
.register(
DebugConfiguration,
!config ? RouterConfiguration : RouterConfiguration.customize(config),
App)
.app({ host: host, component: App });
const router = getModifiedRouter(container);
await au.start().wait();
async function tearDown() {
router.deactivate();
await au.stop().wait();
ctx.doc.body.removeChild(host);
}
return { au, container, lifecycle, host, router, ctx, tearDown };
}
if (hash >= 0) {
path = path.slice(0, hash);
}
wnd.history.replaceState({}, '', path);
const host = doc.createElement('div');
if (App === void 0) {
dependencies = dependencies.map(dep => typeof dep === 'string'
? CustomElement.define({ name: dep, template: `!${dep}!` })
: dep);
App = CustomElement.define({ name: 'app', template: '', dependencies });
}
const au = new Aurelia(container)
.register(
DebugConfiguration,
!config ? RouterConfiguration : RouterConfiguration.customize(config),
App)
.app({ host: host, component: App });
const router = container.get(IRouter);
const { _pushState, _replaceState } = spyNavigationStates(router, stateSpy);
await au.start().wait();
async function tearDown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.deactivate();
RouterConfiguration.customize();
await au.stop().wait();
}
const navigationInstruction: INavigatorInstruction = { instruction: 'test', fullStateInstruction: 'full-test' };
public entry: number = 0;
public reentryBehavior: string = 'default';
public enter(params) {
this.param = +params[0];
this.entry++;
this.reentryBehavior = plughReentryBehavior;
}
});
const host = ctx.doc.createElement('div');
ctx.doc.body.appendChild(host as any);
const au = ctx.wnd['au'] = new Aurelia(container)
.register(
DebugConfiguration,
!config ? RouterConfiguration : RouterConfiguration.customize(config),
App)
.app({ host: host, component: App });
const router = getModifiedRouter(container);
container.register(Foo, Bar, Baz, Qux, Quux, Corge, Uier, Grault, Garply, Waldo, Plugh);
await au.start().wait();
async function tearDown() {
router.deactivate();
await au.stop().wait();
ctx.doc.body.removeChild(host);
}
return { au, container, scheduler, host, router, ctx, tearDown };
async function tearDown() {
unspyNavigationStates(router, _pushState, _replaceState);
router.deactivate();
RouterConfiguration.customize();
await au.stop().wait();
}
Auth,
DateValueConverter,
FormatHtmlValueConverter,
KeysValueConverter,
MarkdownHtmlValueConverter,
SharedState,
HttpClient,
] as any;
(global as any).au = new Aurelia()
.register(
BasicConfiguration,
DebugConfiguration,
RouterConfiguration.customize({ useUrlFragmentHash: false }),
...globalResources,
)
.app({
component: App,
host: document.querySelector('app')!,
})
.start();