Skip to content

Commit 254cc47

Browse files
authored
build: update ng add standalone integration test (#26894)
The layout for a standalone project has changed since we added our integration test.
1 parent 1e8a4f4 commit 254cc47

21 files changed

+1954
-1930
lines changed

integration/ng-add-standalone/.browserslistrc

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

3-
# compiled output
3+
# Compiled output
44
/dist
55
/tmp
66
/out-tsc
7-
# Only exists if Bazel was run
87
/bazel-out
98

10-
# dependencies
9+
# Node
1110
/node_modules
12-
13-
# profiling files
14-
chrome-profiler-events*.json
11+
npm-debug.log
12+
yarn-error.log
1513

1614
# IDEs and editors
17-
/.idea
15+
.idea/
1816
.project
1917
.classpath
2018
.c9/
2119
*.launch
2220
.settings/
2321
*.sublime-workspace
2422

25-
# IDE - VSCode
23+
# Visual Studio Code
2624
.vscode/*
2725
!.vscode/settings.json
2826
!.vscode/tasks.json
2927
!.vscode/launch.json
3028
!.vscode/extensions.json
3129
.history/*
3230

33-
# misc
34-
/.sass-cache
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
3534
/connect.lock
3635
/coverage
3736
/libpeerconnection.log
38-
npm-debug.log
39-
yarn-error.log
4037
testem.log
4138
/typings
4239

43-
# System Files
40+
# System files
4441
.DS_Store
4542
Thumbs.db

integration/ng-add-standalone/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# NgAddStandalone
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.0.0-next.7.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.0-next.7.
44

55
## Development server
66

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
88

99
## Code scaffolding
1010

integration/ng-add-standalone/angular.json

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
"projectType": "application",
88
"schematics": {
99
"@schematics/angular:component": {
10-
"style": "scss"
10+
"style": "scss",
11+
"standalone": true
1112
},
12-
"@schematics/angular:application": {
13-
"strict": true
13+
"@schematics/angular:directive": {
14+
"standalone": true
15+
},
16+
"@schematics/angular:pipe": {
17+
"standalone": true
1418
}
1519
},
1620
"root": "",
@@ -23,7 +27,7 @@
2327
"outputPath": "dist/ng-add-standalone",
2428
"index": "src/index.html",
2529
"main": "src/main.ts",
26-
"polyfills": "src/polyfills.ts",
30+
"polyfills": ["zone.js"],
2731
"tsConfig": "tsconfig.app.json",
2832
"inlineStyleLanguage": "scss",
2933
"assets": ["src/favicon.ico", "src/assets"],
@@ -44,12 +48,6 @@
4448
"maximumError": "4kb"
4549
}
4650
],
47-
"fileReplacements": [
48-
{
49-
"replace": "src/environments/environment.ts",
50-
"with": "src/environments/environment.prod.ts"
51-
}
52-
],
5351
"outputHashing": "all"
5452
},
5553
"development": {
@@ -84,15 +82,13 @@
8482
"test": {
8583
"builder": "@angular-devkit/build-angular:karma",
8684
"options": {
87-
"main": "src/test.ts",
88-
"polyfills": "src/polyfills.ts",
85+
"polyfills": ["zone.js", "zone.js/testing"],
8986
"tsConfig": "tsconfig.spec.json",
9087
"karmaConfig": "karma.conf.js",
9188
"inlineStyleLanguage": "scss",
9289
"assets": ["src/favicon.ico", "src/assets"],
9390
"styles": ["src/styles.scss"],
94-
"scripts": [],
95-
"watch": false
91+
"scripts": []
9692
}
9793
}
9894
}

integration/ng-add-standalone/package.json

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,35 @@
66
"start": "ng serve",
77
"build": "ng build",
88
"watch": "ng build --watch --configuration development",
9-
"test": "ng test"
9+
"test": "ng test --watch=false"
1010
},
1111
"private": true,
1212
"dependencies": {
13-
"@angular/animations": "^15.0.0",
13+
"@angular/animations": "^16.0.0-next.7",
1414
"@angular/cdk": "file:../../dist/releases/cdk",
15-
"@angular/common": "^15.0.0",
16-
"@angular/compiler": "^15.0.0",
17-
"@angular/core": "^15.0.0",
18-
"@angular/forms": "^15.0.0",
15+
"@angular/common": "^16.0.0-next.7",
16+
"@angular/compiler": "^16.0.0-next.7",
17+
"@angular/core": "^16.0.0-next.7",
18+
"@angular/forms": "^16.0.0-next.7",
1919
"@angular/material": "file:../../dist/releases/material",
20-
"@angular/platform-browser": "^15.0.0",
21-
"@angular/platform-browser-dynamic": "^15.0.0",
22-
"@angular/router": "^15.0.0",
23-
"rxjs": "~7.5.0",
20+
"@angular/platform-browser": "^16.0.0-next.7",
21+
"@angular/platform-browser-dynamic": "^16.0.0-next.7",
22+
"@angular/router": "^16.0.0-next.7",
23+
"rxjs": "~7.8.0",
2424
"tslib": "^2.3.0",
25-
"zone.js": "~0.11.4"
25+
"zone.js": "~0.13.0"
2626
},
2727
"devDependencies": {
28-
"@angular-devkit/build-angular": "^15.0.0",
29-
"@angular/cli": "^15.0.0",
30-
"@angular/compiler-cli": "^15.0.0",
31-
"@types/jasmine": "~3.9.0",
32-
"@types/node": "^12.11.1",
33-
"glob": "^7.2.0",
34-
"jasmine-core": "~3.9.0",
35-
"karma": "~6.3.0",
28+
"@angular-devkit/build-angular": "^16.0.0-next.7",
29+
"@angular/cli": "~16.0.0-next.7",
30+
"@angular/compiler-cli": "^16.0.0-next.7",
31+
"@types/jasmine": "~4.3.0",
32+
"jasmine-core": "~4.6.0",
33+
"karma": "~6.4.0",
3634
"karma-chrome-launcher": "~3.1.0",
37-
"karma-coverage": "~2.0.3",
38-
"karma-jasmine": "~4.0.0",
39-
"karma-jasmine-html-reporter": "~1.7.0",
35+
"karma-coverage": "~2.2.0",
36+
"karma-jasmine": "~5.1.0",
37+
"karma-jasmine-html-reporter": "~2.0.0",
4038
"typescript": "file:../../node_modules/typescript"
4139
}
4240
}

integration/ng-add-standalone/src/app/app-routing.module.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

integration/ng-add-standalone/src/app/app.component.html

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ <h2>Resources</h2>
366366
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
367367
</a>
368368

369+
<a class="card" target="_blank" rel="noopener" href="https://material.angular.io">
370+
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 179.2 192.7"><path fill="#ffa726" d="M89.4 0 0 32l13.5 118.4 75.9 42.3 76-42.3L179.2 32 89.4 0z"/><path fill="#fb8c00" d="M89.4 0v192.7l76-42.3L179.2 32 89.4 0z"/><path fill="#ffe0b2" d="m102.9 146.3-63.3-30.5 36.3-22.4 63.7 30.6-36.7 22.3z"/><path fill="#fff3e0" d="M102.9 122.8 39.6 92.2l36.3-22.3 63.7 30.6-36.7 22.3z"/><path fill="#fff" d="M102.9 99.3 39.6 68.7l36.3-22.4 63.7 30.6-36.7 22.4z"/></svg>
371+
<span>Angular Material</span>
372+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
373+
</a>
374+
369375
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.io/">
370376
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
371377
<span>Angular Blog</span>
@@ -430,29 +436,6 @@ <h2>Next Steps</h2>
430436

431437
<!-- Links -->
432438
<div class="card-container">
433-
<a class="circle-link" title="Animations" href="https://angular.io/guide/animations" target="_blank" rel="noopener">
434-
<svg id="Group_20" data-name="Group 20" xmlns="http://www.w3.org/2000/svg" width="21.813" height="23.453" viewBox="0 0 21.813 23.453">
435-
<path id="Path_15" data-name="Path 15" d="M4099.584,972.736h0l-10.882,3.9,1.637,14.4,9.245,5.153,9.245-5.153,1.686-14.4Z" transform="translate(-4088.702 -972.736)" fill="#ffa726"/>
436-
<path id="Path_16" data-name="Path 16" d="M4181.516,972.736v23.453l9.245-5.153,1.686-14.4Z" transform="translate(-4170.633 -972.736)" fill="#fb8c00"/>
437-
<path id="Path_17" data-name="Path 17" d="M4137.529,1076.127l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1058.315)" fill="#ffe0b2"/>
438-
<path id="Path_18" data-name="Path 18" d="M4137.529,1051.705l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1036.757)" fill="#fff3e0"/>
439-
<path id="Path_19" data-name="Path 19" d="M4137.529,1027.283l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1015.199)" fill="#fff"/>
440-
</svg>
441-
</a>
442-
443-
<a class="circle-link" title="CLI" href="https://cli.angular.io/" target="_blank" rel="noopener">
444-
<svg xmlns="http://www.w3.org/2000/svg" width="21.762" height="23.447" viewBox="0 0 21.762 23.447">
445-
<title>Angular CLI Logo</title>
446-
<g id="Group_21" data-name="Group 21" transform="translate(0)">
447-
<path id="Path_20" data-name="Path 20" d="M2660.313,313.618h0l-10.833,3.9,1.637,14.4,9.2,5.152,9.244-5.152,1.685-14.4Z" transform="translate(-2649.48 -313.618)" fill="#37474f"/>
448-
<path id="Path_21" data-name="Path 21" d="M2741.883,313.618v23.447l9.244-5.152,1.685-14.4Z" transform="translate(-2731.05 -313.618)" fill="#263238"/>
449-
<path id="Path_22" data-name="Path 22" d="M2692.293,379.169h11.724V368.618h-11.724Zm11.159-.6h-10.608v-9.345h10.621v9.345Z" transform="translate(-2687.274 -362.17)" fill="#fff"/>
450-
<path id="Path_23" data-name="Path 23" d="M2709.331,393.688l.4.416,2.265-2.28-2.294-2.294-.4.4,1.893,1.893Z" transform="translate(-2702.289 -380.631)" fill="#fff"/>
451-
<rect id="Rectangle_12" data-name="Rectangle 12" width="3.517" height="0.469" transform="translate(9.709 13.744)" fill="#fff"/>
452-
</g>
453-
</svg>
454-
</a>
455-
456439
<a class="circle-link" title="Find a Local Meetup" href="https://www.meetup.com/find/?keywords=angular" target="_blank" rel="noopener">
457440
<svg xmlns="http://www.w3.org/2000/svg" width="24.607" height="23.447" viewBox="0 0 24.607 23.447">
458441
<title>Meetup Logo</title>

integration/ng-add-standalone/src/app/app.component.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import {TestBed} from '@angular/core/testing';
2-
import {RouterTestingModule} from '@angular/router/testing';
32
import {AppComponent} from './app.component';
43

54
describe('AppComponent', () => {
6-
beforeEach(async () => {
7-
await TestBed.configureTestingModule({
8-
imports: [RouterTestingModule],
9-
}).compileComponents();
10-
});
5+
beforeEach(() =>
6+
TestBed.configureTestingModule({
7+
imports: [AppComponent],
8+
}),
9+
);
1110

1211
it('should create the app', () => {
1312
const fixture = TestBed.createComponent(AppComponent);
1413
const app = fixture.componentInstance;
1514
expect(app).toBeTruthy();
1615
});
1716

18-
it(`should have as title 'ng-add-standalone'`, () => {
17+
it(`should have the 'ng-add-standalone' title`, () => {
1918
const fixture = TestBed.createComponent(AppComponent);
2019
const app = fixture.componentInstance;
2120
expect(app.title).toEqual('ng-add-standalone');

integration/ng-add-standalone/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {Component} from '@angular/core';
22
import {CommonModule} from '@angular/common';
3-
import {RouterModule} from '@angular/router';
3+
import {RouterOutlet} from '@angular/router';
44

55
@Component({
66
selector: 'app-root',
7+
standalone: true,
8+
imports: [CommonModule, RouterOutlet],
79
templateUrl: './app.component.html',
810
styleUrls: ['./app.component.scss'],
9-
standalone: true,
10-
imports: [RouterModule, CommonModule],
1111
})
1212
export class AppComponent {
1313
title = 'ng-add-standalone';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {ApplicationConfig} from '@angular/core';
2+
import {provideRouter} from '@angular/router';
3+
4+
import {routes} from './app.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [provideRouter(routes)],
8+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {Routes} from '@angular/router';
2+
3+
export const routes: Routes = [];

integration/ng-add-standalone/src/environments/environment.prod.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

integration/ng-add-standalone/src/environments/environment.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.
694 Bytes
Binary file not shown.
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
import {enableProdMode, importProvidersFrom} from '@angular/core';
2-
import {bootstrapApplication, BrowserModule} from '@angular/platform-browser';
3-
import {AppRoutingModule} from './app/app-routing.module';
1+
import {bootstrapApplication} from '@angular/platform-browser';
2+
import {appConfig} from './app/app.config';
43
import {AppComponent} from './app/app.component';
54

6-
import {environment} from './environments/environment';
7-
8-
if (environment.production) {
9-
enableProdMode();
10-
}
11-
12-
bootstrapApplication(AppComponent, {
13-
providers: [importProvidersFrom(BrowserModule, AppRoutingModule)],
14-
});
5+
bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err));

0 commit comments

Comments
 (0)