Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae45c4a

Browse files
committed
feat(@schematics/angular): update ng new generated application
(cherry picked from commit 42934bc)
1 parent e10f49e commit ae45c4a

File tree

13 files changed

+302
-472
lines changed

13 files changed

+302
-472
lines changed

‎packages/schematics/angular/application/files/common-files/src/app/app.component.html.template‎

Lines changed: 282 additions & 395 deletions
Large diffs are not rendered by default.

‎packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ describe('AppComponent', () => {
3030
const fixture = TestBed.createComponent(AppComponent);
3131
fixture.detectChanges();
3232
const compiled = fixture.nativeElement as HTMLElement;
33-
expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
33+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, <%= name %>');
3434
});
3535
});

‎packages/schematics/angular/application/files/module-files/src/app/app.component.ts.template‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,8 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: '<%= selector %>',<% if(inlineTemplate) { %>
55
template: `
6-
<!--The content below is only a placeholder and can be replaced.-->
7-
<div style="text-align:center" class="content">
8-
<h1>
9-
Welcome to {{title}}!
10-
</h1>
11-
<span style="display: block">{{ title }} app is running!</span>
12-
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
13-
</div>
14-
<h2>Here are some links to help you start: </h2>
15-
<ul>
16-
<li>
17-
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
18-
</li>
19-
<li>
20-
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
21-
</li>
22-
<li>
23-
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
24-
</li>
25-
</ul>
6+
<h1>Welcome to {{title}}!</h1>
7+
268
<% if (routing) {
279
%><router-outlet></router-outlet><%
2810
} %>

‎packages/schematics/angular/application/files/standalone-files/src/app/app.component.spec.ts.template‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ describe('AppComponent', () => {
2424
const fixture = TestBed.createComponent(AppComponent);
2525
fixture.detectChanges();
2626
const compiled = fixture.nativeElement as HTMLElement;
27-
expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
27+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, <%= name %>');
2828
});
2929
});

‎packages/schematics/angular/application/files/standalone-files/src/app/app.component.ts.template‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,8 @@ import { RouterOutlet } from '@angular/router';<% } %>
77
standalone: true,
88
imports: [CommonModule<% if(routing) { %>, RouterOutlet<% } %>],<% if(inlineTemplate) { %>
99
template: `
10-
<!--The content below is only a placeholder and can be replaced.-->
11-
<div style="text-align:center" class="content">
12-
<h1>
13-
Welcome to {{title}}!
14-
</h1>
15-
<span style="display: block">{{ title }} app is running!</span>
16-
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
17-
</div>
18-
<h2>Here are some links to help you start: </h2>
19-
<ul>
20-
<li>
21-
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
22-
</li>
23-
<li>
24-
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
25-
</li>
26-
<li>
27-
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
28-
</li>
29-
</ul>
10+
<h1>Welcome to {{title}}!</h1>
11+
3012
<% if (routing) {
3113
%><router-outlet></router-outlet><%
3214
} %>

‎packages/schematics/angular/e2e/files/src/app.e2e-spec.ts.template‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('workspace-project App', () => {
1010

1111
it('should display welcome message', async () => {
1212
await page.navigateTo();
13-
expect(await page.getTitleText()).toEqual('<%= relatedAppName %> app is running!');
13+
expect(await page.getTitleText()).toEqual('Hello, <%= relatedAppName %>');
1414
});
1515

1616
afterEach(async () => {

‎packages/schematics/angular/e2e/files/src/app.po.ts.template‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export class AppPage {
66
}
77

88
async getTitleText(): Promise<string> {
9-
return element(by.css('<%= rootSelector %> .content span')).getText();
9+
return element(by.css('h1')).getText();
1010
}
1111
}

‎packages/schematics/angular/e2e/index_spec.ts‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,6 @@ describe('Application Schematic', () => {
6262
);
6363
});
6464

65-
it('should set the rootSelector in the app.po.ts', async () => {
66-
const tree = await schematicRunner.runSchematic('e2e', defaultOptions, applicationTree);
67-
68-
const content = tree.readContent('/projects/foo/e2e/src/app.po.ts');
69-
expect(content).toMatch(/app-root/);
70-
});
71-
72-
it('should set the rootSelector in the app.po.ts from the option', async () => {
73-
const options = { ...defaultOptions, rootSelector: 't-a-c-o' };
74-
const tree = await schematicRunner.runSchematic('e2e', options, applicationTree);
75-
76-
const content = tree.readContent('/projects/foo/e2e/src/app.po.ts');
77-
expect(content).toMatch(/t-a-c-o/);
78-
});
79-
80-
it('should set the rootSelector in the app.po.ts from the option with emoji', async () => {
81-
const options = { ...defaultOptions, rootSelector: '🌮-🌯' };
82-
const tree = await schematicRunner.runSchematic('e2e', options, applicationTree);
83-
84-
const content = tree.readContent('/projects/foo/e2e/src/app.po.ts');
85-
expect(content).toMatch(/🌮-🌯/);
86-
});
87-
8865
describe('workspace config', () => {
8966
it('should add e2e targets for the app', async () => {
9067
const tree = await schematicRunner.runSchematic('e2e', defaultOptions, applicationTree);

‎tests/legacy-cli/e2e/tests/basic/standalone.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { bootstrapApplication, provideProtractorTestingSupport } from '@angular/
3030
template: \`
3131
<ng-template [ngIf]="isVisible">
3232
<div class="content">
33-
<span>{{name}} app is running!</span>
33+
<h1>Hello, {{name}}</h1>
3434
</div>
3535
</ng-template>
3636
\`,

‎tests/legacy-cli/e2e/tests/build/ssr/express-engine-csp-nonce.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ export default async function () {
8282
).not.toBeNull();
8383
8484
// Test the contents from the server.
85-
expect(await element(by.css('div')).getText()).toMatch('Welcome');
85+
expect(await element(by.css('h1')).getText()).toMatch('Hello');
8686
8787
// Bootstrap the client side app.
8888
await browser.executeScript('doBootstrap()');
8989
9090
// Retest the contents after the client bootstraps.
91-
expect(await element(by.css('div')).getText()).toMatch('Welcome');
91+
expect(await element(by.css('h1')).getText()).toMatch('Hello');
9292
9393
// Make sure the server styles got replaced by client side ones.
9494
expect(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /