fixup! feat(ivy): adding support for ngNonBindable attribute

This commit is contained in:
Andrew Kushnir 2018-09-26 15:15:06 -07:00 committed by Alex Rickabaugh
parent d7326d81ba
commit bc1f2d6411
2 changed files with 23 additions and 21 deletions

View File

@ -197,6 +197,29 @@ describe('compiler compliance: bindings', () => {
const result = compile(files, angularFiles); const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect handling of local refs for nested elements'); expectEmit(result.source, template, 'Incorrect handling of local refs for nested elements');
}); });
it('should not process property bindings and listeners', () => {
const files: MockDirectory = getAppFiles(`
<div ngNonBindable>
<div [id]="my-id" (click)="onclick"></div>
</div>
`);
const template = `
const $_c0$ = ["[id]", "my-id", "(click)", "onclick"];
template:function MyComponent_Template(rf, $ctx$){
if (rf & 1) {
$i0$.ɵelementStart(0, "div");
$i0$.ɵsetBindingsDisabled();
$i0$.ɵelement(1, "div", $_c0$);
$i0$.ɵsetBindingsEnabled();
$i0$.ɵelementEnd();
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect handling of local refs for nested elements');
});
}); });
}); });

View File

@ -162,27 +162,6 @@ describe('render3 integration test', () => {
expect(fixture.html).toEqual('<b id="my-id"><i>Hello {{ name }}!</i></b> my-id '); expect(fixture.html).toEqual('<b id="my-id"><i>Hello {{ name }}!</i></b> my-id ');
}); });
it('should not have local refs for nested elements', () => {
/**
* <div ngNonBindable>
* <input value="one" #myInput> {{ myInput.value }}
* </div>
*/
const App = createComponent('app', function(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
elementStart(0, 'div');
setBindingsDisabled();
element(1, 'input', ['value', 'one']);
text(2, '{{ myInput.value }}');
setBindingsEnabled();
elementEnd();
}
}, 3, 0);
const fixture = new ComponentFixture(App);
expect(fixture.html).toEqual('<div><input value="one">{{ myInput.value }}</div>');
});
it('should invoke directives for host element', () => { it('should invoke directives for host element', () => {
let directiveInvoked: boolean = false; let directiveInvoked: boolean = false;