Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
register(container: IContainer): void {
container.register(
RuntimeConfiguration,
AuTextRenderer as unknown as IRegistry,
Registration.singleton(IDOM, AuDOM),
Registration.singleton(IDOMInitializer, AuDOMInitializer),
Registration.singleton(IProjectorLocator, AuProjectorLocator),
Registration.singleton(ITargetAccessorLocator, AuObserverLocator),
Registration.singleton(ITargetObserverLocator, AuObserverLocator),
Registration.singleton(ITemplateFactory, AuTemplateFactory),
Registration.instance(ITemplateCompiler, {}), // TODO: fix this dep tree
);
},
createContainer(): IContainer {
register(container: IContainer) {
const options: ValidationCustomizationOpions = { validator: StandardValidator, customMessages: [], defaultTrigger: ValidationTrigger.blur };
optionsProvider(options);
return container.register(
Registration.callback(ICustomMessages, () => options.customMessages),
Registration.callback(IDefaultTrigger, () => options.defaultTrigger),
Registration.singleton(IValidator, options.validator),
Registration.singleton(IValidationMessageProvider, ValidationMessageProvider), // TODO enable customization of messages and i18n
Registration.transient(IValidationRules, ValidationRules),
ValidateBindingBehavior,
ValidationErrorsCustomAttribute,
ValidationRendererCustomAttribute,
Registration.singleton(IValidationControllerFactory, ValidationControllerFactory)
);
},
customize(cb?: ValidationConfigurationProvider) {
it(`stores resource resolvers in resourceResolvers in parent and inherits them from root but does not from parent`, function () {
const type = class {};
const keyFromRoot = 'foo:bar' as any;
const keyFromParent = 'foo:baz' as any;
const root = DI.createContainer();
root.register(Registration.singleton(keyFromRoot, type));
const parent = root.createChild();
parent.register(Registration.singleton(keyFromParent, type));
const parentHasKeyFromRoot = parent['resourceResolvers'][keyFromRoot] !== void 0;
const parentHasKeyFromParent = parent['resourceResolvers'][keyFromParent] !== void 0;
const child = parent.createChild();
const childHasKeyFromRoot = child['resourceResolvers'][keyFromRoot] !== void 0;
const childHasKeyFromParent = child['resourceResolvers'][keyFromParent] !== void 0;
assert.strictEqual(parentHasKeyFromRoot, true, `parentHasKeyFromRoot`);
assert.strictEqual(parentHasKeyFromParent, true, `parentHasKeyFromParent`);
register(container: IContainer): void {
container.register(
RuntimeBasicConfiguration,
AuTextRenderer as unknown as IRegistry,
Registration.singleton(IDOM, AuDOM),
Registration.singleton(IDOMInitializer, AuDOMInitializer),
Registration.singleton(IProjectorLocator, AuProjectorLocator),
Registration.singleton(ITargetAccessorLocator, AuObserverLocator),
Registration.singleton(ITargetObserverLocator, AuObserverLocator),
Registration.singleton(ITemplateFactory, AuTemplateFactory)
);
},
createContainer(): IContainer {
register(container) {
container.register(RuntimeConfiguration, AuTextRenderer, Registration.singleton(IDOM, AuDOM), Registration.singleton(IDOMInitializer, AuDOMInitializer), Registration.singleton(IProjectorLocator, AuProjectorLocator), Registration.singleton(ITargetAccessorLocator, AuObserverLocator), Registration.singleton(ITargetObserverLocator, AuObserverLocator), Registration.instance(ITemplateCompiler, {}));
},
createContainer() {
public constructor() {
const container = this.container = DI.createContainer();
container.register(
Registration.instance(ILogConfig, new LogConfig(ColorOptions.noColors, LogLevel.info)),
Registration.instance(ISink, new BufferedFileSink()),
Registration.instance(ISink, new ConsoleSink(console)),
Registration.singleton(IFileSystem, NodeFileSystem),
);
this.fs = container.get(IFileSystem);
this.logger = container.get(ILogger).scopeTo('TestRunner');
}
register(container) {
return container.register(Registration.callback(I18nInitOptions, () => options.initOptions), StartTask.with(I18N).beforeBind().call(i18n => i18n.task), Registration.singleton(I18nWrapper, I18nextWrapper), Registration.singleton(I18N, I18nService), ...renderers, ...translation);
}
};
static register(container) {
return Registration.singleton(ILifecycle, this).register(container);
}
}
static register(container) {
return Registration.singleton(ITemplateCompiler, this).register(container);
}
compile(dom, definition, descriptions) {
public static register(container: IContainer): IResolver {
return Registration.singleton(IObserverLocator, this).register(container);
}