Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options: TestEnvironmentOptions = {}) {
// let document = options.document || window.document;
// let appendOperations = options.appendOperations || new DOMTreeConstruction(document);
super({
appendOperations: options.appendOperations || new DOMTreeConstruction(options.document as Document || window.document),
updateOperations: new DOMChanges((options.document || window.document) as Document)
});
// recursive field, so "unsafely" set one half late (but before the resolver is actually used)
this.resolver['options'] = this.compileOptions;
this.lookup = new LookupResolver(this.resolver);
let document = options.document || window.document;
this.uselessAnchor = document.createElement('a') as HTMLAnchorElement;
this.registerHelper("if", ([cond, yes, no]) => cond ? yes : no);
this.registerHelper("unless", ([cond, yes, no]) => cond ? no : yes);
this.registerInternalHelper("-get-dynamic-var", getDynamicVar);
this.registerModifier("action", new InertModifierManager());
this.registerInternalHelper("hash", (_vm: VM, args: Arguments) => args.capture().named);
}
}
return false;
});
}
}
export class TestEnvironment extends Environment {
public resolver = new TestResolver();
private program = new Program(this.resolver);
private uselessAnchor: HTMLAnchorElement;
public compiledLayouts = dict();
private lookup: LookupResolver;
public compileOptions: TemplateOptions = {
lookup: new LookupResolver(this.resolver),
program: this.program,
macros: new TestMacros(),
Builder: LazyOpcodeBuilder
};
constructor(options: TestEnvironmentOptions = {}) {
// let document = options.document || window.document;
// let appendOperations = options.appendOperations || new DOMTreeConstruction(document);
super({
appendOperations: options.appendOperations || new DOMTreeConstruction(options.document as Document || window.document),
updateOperations: new DOMChanges((options.document || window.document) as Document)
});
// recursive field, so "unsafely" set one half late (but before the resolver is actually used)
this.resolver['options'] = this.compileOptions;
this.lookup = new LookupResolver(this.resolver);