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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { RouterOutlet } from '@angular/router';<% } %>

@Component({
selector: '<%= selector %>',
standalone: true,
imports: [<% if(routing) { %>RouterOutlet<% } %>],<% if(inlineTemplate) { %>
template: `
<h1>Welcome to {{title}}!</h1>
Expand Down
5 changes: 2 additions & 3 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,10 @@ describe('Application Schematic', () => {

it('should create a standalone component', async () => {
const options = { ...defaultOptions, standalone: true };

const tree = await schematicRunner.runSchematic('application', options, workspaceTree);

const component = tree.readContent('/projects/foo/src/app/app.component.ts');
expect(component).toMatch(/standalone: true/);

expect(component).not.toContain('standalone');
});

it('should create routing information by default', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%

@Component({<% if(!skipSelector) {%>
selector: '<%= selector %>',<%}%><% if(standalone) {%>
standalone: true,
imports: [],<%} else { %>
standalone: false,
<% }%><% if(inlineTemplate) { %>
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/component/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ describe('Component Schematic', () => {
const componentContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
expect(componentContent).toContain('class FooComponent');
expect(moduleContent).not.toContain('FooComponent');
expect(componentContent).toContain('standalone: true');
expect(componentContent).not.toContain('standalone');
});

it('should declare standalone components in the `imports` of a test', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Directive } from '@angular/core';

@Directive({
selector: '[<%= selector %>]'<% if(standalone) {%>,
standalone: true<%} else {%>,
selector: '[<%= selector %>]'<% if(!standalone) {%>,
standalone: false<%}%>
})
export class <%= classify(name) %>Directive {
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/directive/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Directive Schematic', () => {
const options = { ...defaultOptions, standalone: true };
const tree = await schematicRunner.runSchematic('directive', options, appTree);
const directiveContent = tree.readContent('/projects/bar/src/app/foo.directive.ts');
expect(directiveContent).toContain('standalone: true');
expect(directiveContent).not.toContain('standalone');
expect(directiveContent).toContain('class FooDirective');
});

Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/library/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Library Schematic', () => {
it('should create a standalone component', async () => {
const tree = await schematicRunner.runSchematic('library', defaultOptions, workspaceTree);
const componentContent = tree.readContent('/projects/foo/src/lib/foo.component.ts');
expect(componentContent).toContain('standalone: true');
expect(componentContent).not.toContain('standalone');
});

describe('custom projectRoot', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: '<%= camelize(name) %>'<% if(standalone) {%>,
standalone: true<%} else {%>,
name: '<%= camelize(name) %>'<% if(!standalone) {%>,
standalone: false<%}%>
})
export class <%= classify(name) %>Pipe implements PipeTransform {
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/pipe/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('Pipe Schematic', () => {
const tree = await schematicRunner.runSchematic('pipe', defaultOptions, appTree);
const moduleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
const pipeContent = tree.readContent('/projects/bar/src/app/foo.pipe.ts');
expect(pipeContent).toContain('standalone: true');
expect(pipeContent).not.toContain('standalone');
expect(pipeContent).toContain('class FooPipe');
expect(moduleContent).not.toContain('FooPipe');
});
Expand Down