').nodes)).toContain([
'prop', new AbsoluteSourceSpan(7, 11)
]);
});
});
describe('property write', () => {
it('should provide absolute offsets of a property write', () => {
expect(humanizeExpressionSource(parse('
').nodes)).toContain([
'prop = 0', new AbsoluteSourceSpan(14, 22)
]);
});
it('should provide absolute offsets of an accessed property write', () => {
expect(humanizeExpressionSource(parse('
').nodes))
.toContain(['prop.inner = 0', new AbsoluteSourceSpan(14, 28)]);
});
it('should provide absolute offsets of expressions in a property write', () => {
expect(humanizeExpressionSource(parse('
').nodes)).toContain([
'0', new AbsoluteSourceSpan(21, 22)
]);
});
});
describe('"not" prefix', () => {
it('should provide absolute offsets of a "not" prefix', () => {
expect(humanizeExpressionSource(parse('
{{!prop}}
').nodes)).toContain([
'!prop', new AbsoluteSourceSpan(7, 12)
]);
});
it('should provide absolute offsets of expressions in a "not" prefix', () => {
expect(humanizeExpressionSource(parse('
{{!prop}}
').nodes)).toContain([
'prop', new AbsoluteSourceSpan(8, 12)
]);
});
});
describe('safe method call', () => {
it('should provide absolute offsets of a safe method call', () => {
expect(humanizeExpressionSource(parse('
{{prop?.safe()}}
').nodes)).toContain([
'prop?.safe()', new AbsoluteSourceSpan(7, 19)
]);
});
it('should provide absolute offsets of expressions in safe method call', () => {
expect(humanizeExpressionSource(parse('
{{prop?.safe()}}
').nodes)).toContain([
'prop', new AbsoluteSourceSpan(7, 11)
]);
});
});
describe('safe property read', () => {
it('should provide absolute offsets of a safe property read', () => {
expect(humanizeExpressionSource(parse('
{{prop?.safe}}
').nodes)).toContain([
'prop?.safe', new AbsoluteSourceSpan(7, 17)
]);
});
it('should provide absolute offsets of expressions in safe property read', () => {
expect(humanizeExpressionSource(parse('
{{prop?.safe}}
').nodes)).toContain([
'prop', new AbsoluteSourceSpan(7, 11)
]);
});
});
it('should provide absolute offsets of a quote', () => {
expect(humanizeExpressionSource(parse('
').nodes)).toContain([
'a:b', new AbsoluteSourceSpan(13, 16)
]);
});
describe('absolute offsets for template expressions', () => {
it('should work for simple cases', () => {
expect(
humanizeExpressionSource(parse('
{{item}}
').nodes))
.toContain(['items', new AbsoluteSourceSpan(25, 30)]);
});
it('should work with multiple bindings', () => {
expect(humanizeExpressionSource(parse('
').nodes))
.toEqual(jasmine.arrayContaining(
[['As', new AbsoluteSourceSpan(22, 24)], ['Bs', new AbsoluteSourceSpan(35, 37)]]));
});
});
});