Skip to content

Commit c4b435f

Browse files
committed
chor(): Upgrade ng18
1 parent 09739d6 commit c4b435f

File tree

8 files changed

+1995
-1537
lines changed

8 files changed

+1995
-1537
lines changed

apps/ngx-md-demo/src/app/app.module.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,22 @@ import { TablesComponent } from './tables/tables.component';
1919
import { PathComponent } from './path/path.component';
2020
import { VariableBindComponent } from './variable-bind/variable-bind.component';
2121
import { TodoComponent } from './todo/todo.component';
22-
import { HttpClientModule } from '@angular/common/http';
22+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2323
import { AppRoutingModule } from './app.router.module';
2424

25-
@NgModule({
26-
declarations: [
27-
AppComponent,
28-
HomeComponent,
29-
TablesComponent,
30-
PathComponent,
31-
VariableBindComponent,
32-
TodoComponent,
33-
],
34-
imports: [
35-
HttpClientModule,
36-
BrowserModule,
37-
FormsModule,
38-
NgxMdModule.forRoot(),
39-
AppRoutingModule,
40-
],
41-
bootstrap: [AppComponent],
42-
})
25+
@NgModule({ declarations: [
26+
AppComponent,
27+
HomeComponent,
28+
TablesComponent,
29+
PathComponent,
30+
VariableBindComponent,
31+
TodoComponent,
32+
],
33+
bootstrap: [AppComponent],
34+
imports: [
35+
BrowserModule,
36+
FormsModule,
37+
NgxMdModule.forRoot(),
38+
AppRoutingModule],
39+
providers: [provideHttpClient(withInterceptorsFromDi())] })
4340
export class AppModule {}

apps/ngx-md-demo/src/app/path/path.component.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { PathComponent } from './path.component';
44
import { NgxMdModule } from 'libs/ngx-md/src';
5-
import { HttpClientModule } from '@angular/common/http';
5+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
66

77
describe('PathComponent', () => {
88
let component: PathComponent;
99
let fixture: ComponentFixture<PathComponent>;
1010

1111
beforeEach(async(() => {
1212
TestBed.configureTestingModule({
13-
declarations: [PathComponent],
14-
imports: [NgxMdModule.forRoot(), HttpClientModule],
15-
}).compileComponents();
13+
declarations: [PathComponent],
14+
imports: [NgxMdModule.forRoot()],
15+
providers: [provideHttpClient(withInterceptorsFromDi())]
16+
}).compileComponents();
1617
}));
1718

1819
beforeEach(() => {

apps/ngx-md-demo/src/app/tables/tables.component.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { TablesComponent } from './tables.component';
44
import { NgxMdModule } from 'libs/ngx-md/src';
5-
import { HttpClientModule } from '@angular/common/http';
5+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
66

77
describe('TablesComponent', () => {
88
let component: TablesComponent;
99
let fixture: ComponentFixture<TablesComponent>;
1010

1111
beforeEach(async(() => {
1212
TestBed.configureTestingModule({
13-
declarations: [TablesComponent],
14-
imports: [NgxMdModule.forRoot(), HttpClientModule],
15-
}).compileComponents();
13+
declarations: [TablesComponent],
14+
imports: [NgxMdModule.forRoot()],
15+
providers: [provideHttpClient(withInterceptorsFromDi())]
16+
}).compileComponents();
1617
}));
1718

1819
beforeEach(() => {

apps/ngx-md-demo/src/app/todo/todo.component.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { TodoComponent } from './todo.component';
44
import { NgxMdModule } from 'libs/ngx-md/src';
5-
import { HttpClientModule } from '@angular/common/http';
5+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
66

77
describe('TodoComponent', () => {
88
let component: TodoComponent;
99
let fixture: ComponentFixture<TodoComponent>;
1010

1111
beforeEach(async(() => {
1212
TestBed.configureTestingModule({
13-
declarations: [TodoComponent],
14-
imports: [NgxMdModule.forRoot(), HttpClientModule],
15-
}).compileComponents();
13+
declarations: [TodoComponent],
14+
imports: [NgxMdModule.forRoot()],
15+
providers: [provideHttpClient(withInterceptorsFromDi())]
16+
}).compileComponents();
1617
}));
1718

1819
beforeEach(() => {

apps/ngx-md-demo/src/app/variable-bind/variable-bind.component.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
33
import { VariableBindComponent } from './variable-bind.component';
44
import { NgxMdModule } from 'libs/ngx-md/src';
55
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
6-
import { HttpClientModule } from '@angular/common/http';
6+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
77

88
describe('VariableBindComponent', () => {
99
let component: VariableBindComponent;
1010
let fixture: ComponentFixture<VariableBindComponent>;
1111

1212
beforeEach(async(() => {
1313
TestBed.configureTestingModule({
14-
declarations: [VariableBindComponent],
15-
imports: [
16-
NgxMdModule.forRoot(),
17-
HttpClientModule,
14+
declarations: [VariableBindComponent],
15+
imports: [NgxMdModule.forRoot(),
1816
FormsModule,
19-
ReactiveFormsModule,
20-
],
21-
}).compileComponents();
17+
ReactiveFormsModule],
18+
providers: [provideHttpClient(withInterceptorsFromDi())]
19+
}).compileComponents();
2220
}));
2321

2422
beforeEach(() => {

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
},
4444
"private": true,
4545
"dependencies": {
46-
"@angular/animations": "^17.3.12",
47-
"@angular/common": "^17.3.12",
48-
"@angular/compiler": "^17.3.12",
49-
"@angular/core": "^17.3.12",
50-
"@angular/forms": "^17.3.12",
51-
"@angular/platform-browser": "^17.3.12",
52-
"@angular/platform-browser-dynamic": "^17.3.12",
53-
"@angular/router": "^17.3.12",
46+
"@angular/animations": "^18.2.7",
47+
"@angular/common": "^18.2.7",
48+
"@angular/compiler": "^18.2.7",
49+
"@angular/core": "^18.2.7",
50+
"@angular/forms": "^18.2.7",
51+
"@angular/platform-browser": "^18.2.7",
52+
"@angular/platform-browser-dynamic": "^18.2.7",
53+
"@angular/router": "^18.2.7",
5454
"@types/he": "^1.1.2",
5555
"@types/marked": "^4.0.3",
5656
"he": "^1.2.0",
@@ -61,9 +61,9 @@
6161
"zone.js": "^0.14.10"
6262
},
6363
"devDependencies": {
64-
"@angular-devkit/build-angular": "^17.3.10",
65-
"@angular/cli": "^17.3.10",
66-
"@angular/compiler-cli": "^17.3.12",
64+
"@angular-devkit/build-angular": "^18.2.7",
65+
"@angular/cli": "^18.2.7",
66+
"@angular/compiler-cli": "^18.2.7",
6767
"@types/jasmine": "~4.0.0",
6868
"@types/prismjs": "^1.26.0",
6969
"gh-pages": "^4.0.0",
@@ -73,7 +73,7 @@
7373
"karma-coverage": "~2.2.0",
7474
"karma-jasmine": "~5.0.0",
7575
"karma-jasmine-html-reporter": "~1.7.0",
76-
"ng-packagr": "^17.3.0",
76+
"ng-packagr": "^18.2.1",
7777
"typescript": "^5.4.5"
7878
},
7979
"auto": {

projects/ngx-md/src/lib/ngx-md.service.spec.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { TestBed, inject, waitForAsync } from '@angular/core/testing';
2-
import { HttpClient } from '@angular/common/http';
2+
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
33

4-
import {
5-
HttpClientTestingModule,
6-
HttpTestingController,
7-
} from '@angular/common/http/testing';
4+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
85
import { NgxMdService } from './ngx-md.service';
96
import { Type } from '@angular/core';
107

@@ -15,9 +12,9 @@ describe('NgxMdService', () => {
1512

1613
beforeEach(() => {
1714
TestBed.configureTestingModule({
18-
imports: [HttpClientTestingModule],
19-
providers: [NgxMdService],
20-
teardown: { destroyAfterEach: false }
15+
teardown: { destroyAfterEach: false },
16+
imports: [],
17+
providers: [NgxMdService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
2118
});
2219

2320
// Inject the http service and test controller for each test

0 commit comments

Comments
 (0)