feat(ivy): add element instruction (#23899)

Adds a simplified element instruction that can be used if an element
has no children.

PR Close #23899
This commit is contained in:
Ben Lesh
2018-05-25 16:23:00 -07:00
committed by Victor Berchet
parent d6989c80d3
commit b415010222
13 changed files with 117 additions and 78 deletions

View File

@ -109,4 +109,43 @@ describe('compiler compliance: template', () => {
expectEmit(result.source, template, 'Incorrect template');
});
// tslint:disable-next-line:ban
describe('element with no children', () => {
it('should just use the element instruction', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
@Component({
selector: 'my-component',
template: \`
<div></div>\`
})
export class MyComponent {
}
@NgModule({declarations: [MyComponent], imports: [CommonModule]})
export class MyModule {}
`
}
};
const template = `
// ...
template:function MyComponent_Template(rf: IDENT, $ctx$: IDENT){
if (rf & 1) {
$i0$.ɵEe(0,'div');
}
}`;
debugger;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
});
});