refactor(compiler): Drop support for the deprecated <template>
. Use <ng-template>
instead (#22783)
BREAKING CHANGE: The `<template>` tag was deprecated in Angular v4 to avoid collisions (i.e. when using Web Components). This commit removes support for `<template>`. `<ng-template>` should be used instead. BEFORE: <!-- html template --> <template>some template content</template> # tsconfig.json { # ... "angularCompilerOptions": { # ... # This option is no more supported and will have no effect "enableLegacyTemplate": [true|false] } } AFTER: <!-- html template --> <ng-template>some template content</ng-template> PR Close #22783
This commit is contained in:

committed by
Miško Hevery

parent
4e6ac185e5
commit
0ebd577db4
@ -38,14 +38,7 @@ const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');
|
||||
function declareTests({useJit}: {useJit: boolean}) {
|
||||
describe('integration tests', function() {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureCompiler({
|
||||
useJit,
|
||||
providers: [
|
||||
{provide: CompilerConfig, useValue: new CompilerConfig({enableLegacyTemplate: true})}
|
||||
]
|
||||
});
|
||||
});
|
||||
beforeEach(() => { TestBed.configureCompiler({useJit}); });
|
||||
|
||||
describe('react to record changes', function() {
|
||||
it('should consume text node changes', () => {
|
||||
@ -420,22 +413,6 @@ function declareTests({useJit}: {useJit: boolean}) {
|
||||
expect(getDOM().isCommentNode(childNodesOfWrapper[0])).toBe(true);
|
||||
});
|
||||
|
||||
it('should support template directives via `template` attribute.', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]});
|
||||
const template =
|
||||
'<span template="some-viewport: let greeting=someTmpl">{{greeting}}</span>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const childNodesOfWrapper = getDOM().childNodes(fixture.nativeElement);
|
||||
// 1 template + 2 copies.
|
||||
expect(childNodesOfWrapper.length).toBe(3);
|
||||
expect(childNodesOfWrapper[1]).toHaveText('hello');
|
||||
expect(childNodesOfWrapper[2]).toHaveText('again');
|
||||
});
|
||||
|
||||
it('should allow to transplant TemplateRefs into other ViewContainers', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
|
Reference in New Issue
Block a user