Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/compiler/src/render3/r3_template_transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ class HtmlAstToIvyAst implements html.Visitor {
`Attribute bindings are not supported on ng-container. Use property bindings instead.`,
bound.sourceSpan,
);
// TODO(v23): Enable this breaking change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ The tests from #70808 were dropped here. Could we bring them into r3_template_transform_spec.ts as xit with a TODO(v23)? That's what the CSS-variable change did (shadow_css_spec.ts, dom_renderer_spec.ts), and it makes the v23 switch-over mechanical.

@JeanMeche JeanMeche Nov 7, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Added the tests from #70808 into r3_template_transform_spec.ts as xit with // TODO(v23): Enable this breaking change.

// g3-only-start
// } else if (
// bound.type === BindingType.Class ||
// (bound.type === BindingType.Property && bound.name === 'class')
// ) {
// this.reportError(`Class bindings are not supported on ng-container.`, bound.sourceSpan);
// g3-only-end
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions packages/compiler/test/render3/r3_template_transform_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3098,12 +3098,36 @@ describe('R3 template transform', () => {
);
});

// TODO(v23): Enable this breaking change
xit('should report an error for class bindings on ng-container', () => {
const template = `<ng-container [class.foo]="true"></ng-container>`;
const errors = parse(template, {ignoreError: true}).errors;
expect(errors.length).toBe(1);
expect(errors[0].msg).toBe('Class bindings are not supported on ng-container.');
});

// TODO(v23): Enable this breaking change
xit('should report an error for [class] property bindings on ng-container', () => {
const template = `<ng-container [class]="'my-class'"></ng-container>`;
const errors = parse(template, {ignoreError: true}).errors;
expect(errors.length).toBe(1);
expect(errors[0].msg).toBe('Class bindings are not supported on ng-container.');
});

it('should not report an error on non-attr bindings on ng-container', () => {
const template = `<ng-container *ngIf"test" [ngTemplateOutlet]="foo"></ng-container>`;
const errors = parse(template, {ignoreError: true}).errors;
expect(errors.length).toBe(0);
});

// TODO(v23): Enable this breaking change
xit('should report an error for class interpolation on ng-container', () => {
const template = `<ng-container class="{{foo}}"></ng-container>`;
const errors = parse(template, {ignoreError: true}).errors;
expect(errors.length).toBe(1);
expect(errors[0].msg).toBe('Class bindings are not supported on ng-container.');
});

describe('@content blocks', () => {
it('should parse a valid @content block', () => {
expectFromHtml(`
Expand Down
Loading