test: allow signal component test to pass

This commit is contained in:
JoostK
2023-06-08 15:17:33 +02:00
committed by Paul Gschwendtner
parent 977bd97717
commit 080bdfa77f
2 changed files with 21 additions and 21 deletions
@@ -51,25 +51,23 @@ function processLexicalScope(view: ViewCompilation, ops: ir.OpList<ir.CreateOp|i
scope.set(op.variable.view, new ir.ReadVariableExpr(op.xref));
}
break;
case ir.OpKind.Listener:
processLexicalScope(view, op.handlerOps);
break;
}
break;
case ir.OpKind.Listener:
processLexicalScope(view, op.handlerOps);
break;
}
for (const op of ops) {
ir.transformExpressionsInOp(op, expr => {
if (expr instanceof ir.ContextExpr) {
if (!scope.has(expr.view)) {
throw new Error(
`No context found for reference to view ${expr.view} from view ${view.xref}`);
}
return scope.get(expr.view)!;
} else {
return expr;
}
}, ir.VisitorContextFlag.None);
}
}
for (const op of ops) {
ir.transformExpressionsInOp(op, expr => {
if (expr instanceof ir.ContextExpr) {
if (!scope.has(expr.view)) {
throw new Error(
`No context found for reference to view ${expr.view} from view ${view.xref}`);
}
return scope.get(expr.view)!;
} else {
return expr;
}
}, ir.VisitorContextFlag.None);
}
}
@@ -10,6 +10,8 @@ import {USE_TEMPLATE_PIPELINE} from '@angular/compiler/src/template/pipeline/swi
import {Component, input} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {Input} from '../../../src/metadata';
if (!USE_TEMPLATE_PIPELINE) {
console.error(
@@ -23,11 +25,11 @@ describe('Signal component inputs', () => {
@Component({
selector: 'print',
signals: true,
template: `num()`,
template: `{{num()}}`,
standalone: true,
})
class Print {
num = input(0);
@Input() num = input(0);
}
@Component({