Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
private outletRef: VersionedPathReference,
env: Environment
) {
// The router always dirties the root state.
let tag = (this.tag = outletRef.tag);
if (EMBER_ROUTING_MODEL_ARG) {
let modelRef = new OutletModelReference(outletRef, env);
let map = dict();
map.model = modelRef;
// TODO: the functionailty to create a proper CapturedArgument should be
// exported by glimmer, or that it should provide an overload for `curry`
// that takes `PreparedArguments`
this.args = {
tag,
positional: EMPTY_ARGS.positional,
named: {
tag,
map,
names: ['model'],
references: [modelRef],
length: 1,
has(key: string): boolean {
return key === 'model';
for (let prop in attributes) {
expectedCount++;
let expected = attributes[prop];
let matcher: Matcher = isMatcher(expected) ? expected : equalsAttr(expected);
expectedAttrs[prop] = matcher;
QUnit.assert.pushResult({
result: expectedAttrs[prop].match(element && element.getAttribute(prop)),
actual: matcher.fail(element && element.getAttribute(prop)),
expected: matcher.fail(element && element.getAttribute(prop)),
message: `Expected ${description}'s ${prop} attribute ${matcher.expected()}`,
});
}
let actualAttributes = dict();
if (element) {
for (let i = 0, l = element.attributes.length; i < l; i++) {
actualAttributes[element.attributes[i].name] = element.attributes[i].value;
}
}
if (!(element instanceof HTMLElement)) {
QUnit.assert.pushResult({
result: element instanceof HTMLElement,
actual: null,
expected: null,
message: 'Element must be an HTML Element, not an SVG Element',
});
} else {
QUnit.assert.pushResult({
result: element.attributes.length === expectedCount,
result: false,
actual: element,
expected: true,
message: `failed - expected element to not be null`
});
return;
}
QUnit.assert.pushResult({
result: element.tagName === tagName.toUpperCase(),
actual: element.tagName.toLowerCase(),
expected: tagName,
message: `expect tagName to be ${tagName}`
});
let expectedAttrs: Dict = dict();
let expectedCount = 0;
for (let prop in attributes) {
expectedCount++;
let expected = attributes[prop];
let matcher: Matcher = typeof expected === 'object' && MATCHER in expected ? expected : equalsAttr(expected);
expectedAttrs[prop] = matcher;
QUnit.assert.pushResult({
result: expectedAttrs[prop].match(element && element.getAttribute(prop)),
actual: matcher.fail(element && element.getAttribute(prop)),
expected: matcher.fail(element && element.getAttribute(prop)),
message: `Expected element's ${prop} attribute ${matcher.expected()}`
});
}
function mapObject(
object: T,
callback: (value: T[K], key: K) => U[K]
): U {
let out: any = dict();
Object.keys(object).forEach(k => {
out[k] = callback(object[k] as any, k);
});
return out;
}
export function specifierFor(module: ModuleName, name: NamedExport = 'default'): Specifier {
let specifiers = SPECIFIERS[module];
if (!specifiers) specifiers = SPECIFIERS[module] = dict();
let specifier = specifiers[name];
if (!specifier) specifier = specifiers[name] = { module, name };
return specifier;
}
entries(hash, (key, value) => {
if (key === 'as') {
blockParams = Array.isArray(value) ? value : [value];
} else {
out = out || dict();
out[key] = normalizeExpression(value as BuilderExpression);
}
});
constructor(parent: Meta) {
this.tags = dict();
this.trackedProperties = parent ? Object.create(parent.trackedProperties) : dict();
}
private formatHash(hash: WireFormat.Core.Hash): Option {
if (hash === null) return null;
return hash[0].reduce((accum, key, index) => {
accum[key] = this.formatOpcode(hash[1][index]);
return accum;
}, dict());
}
export function normalizeBuilderBlockStatement(
statement: BuilderBlockStatement
): NormalizedBuilderBlockStatement {
let head = statement[0];
let blocks: NormalizedBlocks = dict();
let params: Option = null;
let hash: Option = null;
let blockParams: Option = null;
if (statement.length === 2) {
blocks = normalizeBlocks(statement[1]);
} else if (statement.length === 3) {
if (Array.isArray(statement[1])) {
params = normalizeParams(statement[1]);
} else {
({ hash, blockParams } = normalizeBlockHash(statement[1]));
}
blocks = normalizeBlocks(statement[2]);
} else if (statement.length === 4) {
params = normalizeParams(statement[1]);
getReferenceTypes(): Dict> {
this.referenceTypes = this.referenceTypes || dict>();
return this.referenceTypes;
}