Skip to content

Commit a720094

Browse files
leonsenftalxhub
authored andcommitted
refactor(core): format @content blocks consistently (#69502)
`@content(name)` -> `@content (name)` to align with other block syntax. PR Close #69502
1 parent 555fc20 commit a720094

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

packages/compiler-cli/src/ngtsc/annotations/component/src/foreign_component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class ForeignComponentFeatureAnalyzer extends TmplAstRecursiveVisitor {
347347
);
348348
}
349349

350-
// Explicitly defining a `@content(children)` block without parameters is unnecessary because
350+
// Explicitly defining a `@content (children)` block without parameters is unnecessary because
351351
// child nodes are implicitly passed to the `children` property.
352352
if (block.name === CHILDREN && block.variables.length === 0) {
353353
this.diagnostics.push(

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/standalone/GOLDEN_PARTIAL.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,10 @@ export class TestCmpChildren {
421421
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpChildren, deps: [], target: i0.ɵɵFactoryTarget.Component });
422422
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", type: TestCmpChildren, isStandalone: true, selector: "main-children", ngImport: i0, template: `
423423
<FancyButton [label]="title">
424-
@content(icon) {
424+
@content (icon) {
425425
<span>Icon!</span>
426426
}
427-
@content(description) {
427+
@content (description) {
428428
<span>Description text</span>
429429
}
430430
<span>Other children</span>
@@ -437,10 +437,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
437437
selector: 'main-children',
438438
template: `
439439
<FancyButton [label]="title">
440-
@content(icon) {
440+
@content (icon) {
441441
<span>Icon!</span>
442442
}
443-
@content(description) {
443+
@content (description) {
444444
<span>Description text</span>
445445
}
446446
<span>Other children</span>
@@ -458,7 +458,7 @@ export class TestCmpRenderProps {
458458
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: TestCmpRenderProps, deps: [], target: i0.ɵɵFactoryTarget.Component });
459459
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", type: TestCmpRenderProps, isStandalone: true, selector: "main-render-props", ngImport: i0, template: `
460460
<FancyButton [label]="title">
461-
@content(items; let item, index) {
461+
@content (items; let item, index) {
462462
<span>#{{index}}: {{item}}</span>
463463
}
464464
</FancyButton>
@@ -470,7 +470,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
470470
selector: 'main-render-props',
471471
template: `
472472
<FancyButton [label]="title">
473-
@content(items; let item, index) {
473+
@content (items; let item, index) {
474474
<span>#{{index}}: {{item}}</span>
475475
}
476476
</FancyButton>

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/standalone/foreign_component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export class TestCmp {
3131
selector: 'main-children',
3232
template: `
3333
<FancyButton [label]="title">
34-
@content(icon) {
34+
@content (icon) {
3535
<span>Icon!</span>
3636
}
37-
@content(description) {
37+
@content (description) {
3838
<span>Description text</span>
3939
}
4040
<span>Other children</span>
@@ -54,7 +54,7 @@ export class TestCmpChildren {
5454
selector: 'main-render-props',
5555
template: `
5656
<FancyButton [label]="title">
57-
@content(items; let item, index) {
57+
@content (items; let item, index) {
5858
<span>#{{index}}: {{item}}</span>
5959
}
6060
</FancyButton>

packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ runInEachFileSystem(() => {
23292329
23302330
@Component({
23312331
selector: 'test',
2332-
template: '<FancyButton> @content(icon) {} </FancyButton>',
2332+
template: '<FancyButton> @content (icon) {} </FancyButton>',
23332333
foreignImports: [frameworkImport(FancyButton)],
23342334
})
23352335
export class TestCmp {}
@@ -2347,7 +2347,7 @@ runInEachFileSystem(() => {
23472347
23482348
@Component({
23492349
selector: 'test',
2350-
template: '<div> @content(icon) {} </div>',
2350+
template: '<div> @content (icon) {} </div>',
23512351
foreignImports: [frameworkImport(FancyButton)],
23522352
})
23532353
export class TestCmp {}
@@ -2369,7 +2369,7 @@ runInEachFileSystem(() => {
23692369
23702370
@Component({
23712371
selector: 'test',
2372-
template: '<FancyButton> <div> @content(icon) {} </div> </FancyButton>',
2372+
template: '<FancyButton> <div> @content (icon) {} </div> </FancyButton>',
23732373
foreignImports: [frameworkImport(FancyButton)],
23742374
})
23752375
export class TestCmp {}

packages/core/test/acceptance/foreign_component/foreign_component_spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ describe('foreign components', () => {
226226
selector: 'test-cmp',
227227
template: `
228228
<Card>
229-
@content(header) {
229+
@content (header) {
230230
<h1>My Title</h1>
231231
}
232232
<p>Card body content</p>
233-
@content(footer) {
233+
@content (footer) {
234234
<button>Close</button>
235235
}
236236
</Card>
@@ -377,10 +377,10 @@ describe('foreign components', () => {
377377

378378
expect(fixture.nativeElement.innerHTML).toBe(
379379
'' +
380-
'<!--container-->' + // @content(children) (implicit)
380+
'<!--container-->' + // @content (children) (implicit)
381381
'<!--foreign-view-head-->' + // <SimpleWrapper>
382382
'<div class="wrapper">' +
383-
'<!--container-->' + // @content(children) (implicit)
383+
'<!--container-->' + // @content (children) (implicit)
384384
'<!--foreign-view-head-->' + // <FancyButton>
385385
'<button>' +
386386
'<span id="text">Inside wrapper button</span>' +
@@ -448,7 +448,7 @@ describe('foreign components', () => {
448448
selector: 'test-cmp',
449449
template: `
450450
<FancyList>
451-
@content(renderHeader; let _) {
451+
@content (renderHeader; let _) {
452452
<span>Header Content</span>
453453
}
454454
</FancyList>
@@ -463,7 +463,7 @@ describe('foreign components', () => {
463463

464464
expect(fixture.nativeElement.innerHTML).toBe(
465465
'' +
466-
'<!--container-->' + // for @content(renderHeader)
466+
'<!--container-->' + // for @content (renderHeader)
467467
'<!--foreign-view-head-->' +
468468
'<div><span>Header Content</span></div>' +
469469
'<!--foreign-view-tail-->' +
@@ -487,7 +487,7 @@ describe('foreign components', () => {
487487
selector: 'test-cmp',
488488
template: `
489489
<FancyList>
490-
@content(renderItem; let item) {
490+
@content (renderItem; let item) {
491491
<span>{{ item }}</span>
492492
}
493493
</FancyList>
@@ -502,7 +502,7 @@ describe('foreign components', () => {
502502

503503
expect(fixture.nativeElement.innerHTML).toBe(
504504
'' +
505-
'<!--container-->' + // for @content(renderItem)
505+
'<!--container-->' + // for @content (renderItem)
506506
'<!--foreign-view-head-->' +
507507
'<div><span>Hello Single</span></div>' +
508508
'<!--foreign-view-tail-->' +
@@ -528,7 +528,7 @@ describe('foreign components', () => {
528528
selector: 'test-cmp',
529529
template: `
530530
<FancyTable>
531-
@content(renderRow; let row, idx, isLast) {
531+
@content (renderRow; let row, idx, isLast) {
532532
<span>{{ idx }} - {{ row }} (Last: {{ isLast }})</span>
533533
}
534534
</FancyTable>
@@ -543,7 +543,7 @@ describe('foreign components', () => {
543543

544544
expect(fixture.nativeElement.innerHTML).toBe(
545545
'' +
546-
'<!--container-->' + // for @content(renderRow)
546+
'<!--container-->' + // for @content (renderRow)
547547
'<!--foreign-view-head-->' +
548548
'<div><span>0 - RowA (Last: false)</span></div>' +
549549
'<!--foreign-view-tail-->' +
@@ -591,9 +591,9 @@ describe('foreign components', () => {
591591
selector: 'test-cmp',
592592
template: `
593593
<OuterComp>
594-
@content(renderContent; let message) {
594+
@content (renderContent; let message) {
595595
<InnerComp>
596-
@content(renderHeader; let innerMessage) {
596+
@content (renderHeader; let innerMessage) {
597597
{{ message }} - {{ innerMessage }}
598598
}
599599
Body Content
@@ -611,11 +611,11 @@ describe('foreign components', () => {
611611

612612
expect(fixture.nativeElement.innerHTML).toBe(
613613
'' +
614-
'<!--container-->' + // @content(renderContent)
614+
'<!--container-->' + // @content (renderContent)
615615
'<!--foreign-view-head-->' + // <OuterComp>
616616
'<div class="outer">' +
617-
'<!--container-->' + // @content(renderHeader)
618-
'<!--container-->' + // @content(children) (implicit)
617+
'<!--container-->' + // @content (renderHeader)
618+
'<!--container-->' + // @content (children) (implicit)
619619
'<!--foreign-view-head-->' + // <InnerComp>
620620
'<div class="inner">' +
621621
'<div class="inner-header"> Outer Msg - Inner Msg </div>' +
@@ -887,7 +887,7 @@ describe('foreign components', () => {
887887
@Component({
888888
template: `
889889
<DynamicIf [injector]="injector" [cond]="visible">
890-
@content(children; let result) {
890+
@content (children; let result) {
891891
<child>{{ result }}</child>
892892
}
893893
</DynamicIf>

0 commit comments

Comments
 (0)