mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(compiler): fix detection of directive deps in JIT (#62666)
This fix also matches the implementation to the jsdoc for `hasDirectiveDependencies` "Whether any of the component's dependencies are directives" fixes #62573 PR Close #62666
This commit is contained in:
committed by
Kirill Cherkashin
parent
c2625575aa
commit
8ad10fd63b
@@ -657,7 +657,7 @@ function convertDeclareComponentFacadeToMetadata(
|
||||
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
||||
}
|
||||
|
||||
const hasDirectiveDependencies = declarations.every(
|
||||
const hasDirectiveDependencies = declarations.some(
|
||||
({kind}) =>
|
||||
kind === R3TemplateDependencyKind.Directive || kind === R3TemplateDependencyKind.NgModule,
|
||||
);
|
||||
|
||||
@@ -387,6 +387,35 @@ describe('component declaration jit compilation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should bind directive inputs as regular property (not DOM property) in the presence of pipes', () => {
|
||||
// https://github.com/angular/angular/issues/62573
|
||||
const def = ɵɵngDeclareComponent({
|
||||
version: '18.0.0',
|
||||
type: TestClass,
|
||||
isStandalone: true,
|
||||
dependencies: [
|
||||
{
|
||||
kind: 'directive',
|
||||
type: TestDir,
|
||||
selector: '[dir]',
|
||||
inputs: ['dir'],
|
||||
},
|
||||
{
|
||||
kind: 'pipe',
|
||||
type: TestPipe,
|
||||
name: 'test',
|
||||
},
|
||||
],
|
||||
template: `<div [dir]="'test' | test"></div>`,
|
||||
}) as ComponentDef<TestClass>;
|
||||
|
||||
expectComponentDef(def, {
|
||||
template: functionContaining([/property[^(]*\('dir',/]),
|
||||
directives: [TestDir],
|
||||
pipes: [TestPipe],
|
||||
});
|
||||
});
|
||||
|
||||
it('should compile used components', () => {
|
||||
const def = ɵɵngDeclareComponent({
|
||||
version: '18.0.0',
|
||||
|
||||
Reference in New Issue
Block a user