本文整理汇总了TypeScript中aurelia-framework.Container.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Container.get方法的具体用法?TypeScript Container.get怎么用?TypeScript Container.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurelia-framework.Container
的用法示例。
在下文中一共展示了Container.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
let container = new Container();
router = container.get(Router);
routerConfig = container.get(RouterConfiguration);
spyOn(routerConfig, 'map');
app = new App();
});
示例2: beforeEach
beforeEach(() => {
container = new Container();
settings = container.get(Settings);
ELECTRON.getPath = (p: string) => {
if (p === 'userData') return 'c:/appdata/monterey';
};
FS.join = (...args) => Array.prototype.slice.call(args).join('/');
FS.access = (p: any, x: any) => Promise.resolve(true);
FS.getConstants = () => {
return {
W_OK: true,
R_OK: true
};
};
sut = container.get(FileSystemLogger);
});
示例3: it
it('handles attribute changed when attached to custom element', async () => {
const hrefValue = 'AASSSBBBVCVVCC';
const controller = {
viewModel: {} as any
};
container.registerInstance(Router, {
ensureConfigured: () => {
return Promise.resolve();
},
generate: () => hrefValue
});
container.registerInstance(Element, element = document.createElement('div'));
routeHref = container.get(RouteHref);
routeHref.isActive = true;
(element as any).au = { 'route-href': routeHref, controller };
const spy = spyOn(RouteHref.prototype, 'processChange').and.callThrough();
expect(routeHref.attribute).toBe('href');
routeHref.attributeChanged('href', 'href');
expect(spy).toHaveBeenCalledTimes(1);
await wait(100);
expect(routeHref.isActive).toBe(true);
expect(controller.viewModel.href).toBe(hrefValue);
routeHref.attribute = 'link';
routeHref.attributeChanged('link', 'href');
expect(element.getAttribute('href')).toBe(null);
expect(spy).toHaveBeenCalledTimes(2);
await wait(100);
expect(controller.viewModel.link).toBe(hrefValue);
});
示例4:
driverCreators.forEach((driverCreatorClass, propertyName) => {
let driverCreatorInstance: DriverCreator = diContainer.get(driverCreatorClass)
const { driverCreator, dispose } = driverCreatorInstance.makeDriver(context, propertyName, changes$)
drivers[`${propertyName}$`] = driverCreator
disposeMethods.add(dispose)
})
示例5: beforeEach
beforeEach(() => {
container = new Container();
sut = container.get(ExitProcedure);
SESSION.getEnv = () => 'production';
spyOn(OS, 'kill');
});
示例6: beforeEach
beforeEach(() => {
container = new Container();
this.selectedProject = {};
this.dialogController = { ok: jasmine.createSpy('dialog controller ok()') };
container.registerInstance(SelectedProject, this.selectedProject);
container.registerInstance(DialogController, this.dialogController);
sut = container.get(RenameModal);
});
示例7: beforeEach
beforeEach(() => {
let container = new Container();
container.registerInstance(ValidationController, { validate: () => [] });
container.registerInstance(GithubAPI, { getContents: async () => { return { status: 404 }; } });
sut = container.get(UrlInput);
sut.state = {
github: {}
};
});
示例8: beforeEach
beforeEach(() => {
container = new Container();
logger = {
error: jasmine.createSpy('logger.error'),
info: jasmine.createSpy('logger.info'),
warn: jasmine.createSpy('logger.warn'),
success: jasmine.createSpy('logger.success')
};
LogManager.getLogger = () => logger;
sut = container.get(Notification);
});
示例9: it
it('creates real', () => {
const container = new Container();
routeLoader = container.get(TemplatingRouteLoader);
const router = new Router(container, new History() as any);
const childContainer = routeLoader.createChildContainer(router);
const childRouter = childContainer.getChildRouter!();
childRouter.parent = null;
const resolver = childContainer.getResolver(Router);
expect(resolver.strategy).toBe(3);
expect(childContainer.hasResolver(Router));
expect(childContainer.get(Router)).toBe(childRouter);
});