fix(ivy): ignore empty bindings (#28059)
This update aligns Ivy behavior with ViewEngine related to empty bindings (for example <div [someProp]></div>): empty bindings are ignored. PR Close #28059
This commit is contained in:
@ -120,6 +120,23 @@ describe('compiler compliance: bindings', () => {
|
||||
const result = compile(files, angularFiles);
|
||||
expectEmit(result.source, template, 'Incorrect interpolated property binding');
|
||||
});
|
||||
|
||||
it('should ignore empty bindings', () => {
|
||||
const files: MockDirectory = {
|
||||
app: {
|
||||
'example.ts': `
|
||||
import {Component} from '@angular/core';
|
||||
@Component({
|
||||
selector: 'test',
|
||||
template: '<div [someProp]></div>'
|
||||
})
|
||||
class FooCmp {}
|
||||
`
|
||||
}
|
||||
};
|
||||
const result = compile(files, angularFiles);
|
||||
expect(result.source).not.toContain('i0.ɵelementProperty');
|
||||
});
|
||||
});
|
||||
|
||||
describe('host bindings', () => {
|
||||
|
@ -908,6 +908,21 @@ describe('ngtsc behavioral tests', () => {
|
||||
'changeDetection must be a member of ChangeDetectionStrategy enum from @angular/core');
|
||||
});
|
||||
|
||||
it('should ignore empty bindings', () => {
|
||||
env.tsconfig();
|
||||
env.write(`test.ts`, `
|
||||
import {Component} from '@angular/core';
|
||||
@Component({
|
||||
selector: 'test',
|
||||
template: '<div [someProp]></div>'
|
||||
})
|
||||
class FooCmp {}
|
||||
`);
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).not.toContain('i0.ɵelementProperty');
|
||||
});
|
||||
|
||||
it('should correctly recognize local symbols', () => {
|
||||
env.tsconfig();
|
||||
env.write('module.ts', `
|
||||
|
Reference in New Issue
Block a user