Skip to content

Commit ab1fc36

Browse files
Merge pull request #9406 from JeraldJF/angular-16-upgrade
Angular 16 upgrade
2 parents 8a47408 + bc9789b commit ab1fc36

File tree

73 files changed

+193
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+193
-275
lines changed

src/app/client/__mocks__/chart.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Mock Chart.js module for Jest tests
2+
module.exports = {
3+
Chart: {
4+
register: jest.fn(),
5+
registerables: [],
6+
defaults: { global: {} }
7+
},
8+
registerables: [],
9+
CategoryScale: jest.fn(),
10+
LinearScale: jest.fn(),
11+
BarElement: jest.fn(),
12+
Title: jest.fn(),
13+
Tooltip: jest.fn(),
14+
Legend: jest.fn(),
15+
PointElement: jest.fn(),
16+
LineElement: jest.fn(),
17+
Filler: jest.fn(),
18+
ArcElement: jest.fn(),
19+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Mock ng2-charts module for Jest tests
2+
module.exports = {
3+
BaseChartDirective: class MockBaseChartDirective {
4+
constructor() {
5+
this.data = null;
6+
this.options = null;
7+
this.chart = null;
8+
this.update = jest.fn();
9+
this.render = jest.fn();
10+
}
11+
},
12+
NgChartsModule: class MockNgChartsModule {},
13+
Chart: {
14+
register: jest.fn(),
15+
registerables: [],
16+
defaults: { global: {} }
17+
}
18+
};

src/app/client/angular.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@
3636
},
3737
{
3838
"glob": "**/*",
39-
"input": "./node_modules/@project-sunbird/sunbird-pdf-player-web-component/lib/assets/",
39+
"input": "./node_modules/@project-sunbird/sunbird-pdf-player-web-component/assets/",
4040
"output": "/assets/"
4141
},
4242
{
4343
"glob": "**/*",
44-
"input": "./node_modules/@project-sunbird/sunbird-epub-player-web-component/lib/assets/",
44+
"input": "./node_modules/@project-sunbird/sunbird-epub-player-web-component/assets/",
4545
"output": "/assets/"
4646
},
4747
{
4848
"glob": "**/*",
49-
"input": "./node_modules/@project-sunbird/sunbird-video-player-web-component/lib/assets/",
49+
"input": "./node_modules/@project-sunbird/sunbird-video-player-web-component/assets/",
5050
"output": "/assets/"
5151
},
5252
{
@@ -76,7 +76,7 @@
7676
},
7777
{
7878
"glob": "**/*",
79-
"input": "node_modules/@project-sunbird/sunbird-quml-player-web-component/lib/assets",
79+
"input": "node_modules/@project-sunbird/sunbird-quml-player-web-component/assets",
8080
"output": "/assets/"
8181
},
8282
{

src/app/client/jest-global-mocks.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,17 @@ if (!global.crypto) {
8080
const util = require('util');
8181
if (!(global as any).util) {
8282
(global as any).util = util;
83-
}
83+
}
84+
85+
// Mock Chart.js for ng2-charts compatibility
86+
const Chart = {
87+
register: jest.fn(),
88+
registerables: [],
89+
defaults: {
90+
global: {}
91+
}
92+
};
93+
94+
// Make Chart available globally for tests
95+
(global as any).Chart = Chart;
96+
(window as any).Chart = Chart;

src/app/client/package.json

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"inject-cdn-fallback": "gulp inject:cdnFallBack:script",
2929
"with-stats": "node --max_old_space_size=8096 node_modules/.bin/ng build --configuration production --stats-json",
3030
"build:stats": "ng build --stats-json",
31-
"analyze": "webpack-bundle-analyzer dist/stats.json",
32-
"postinstall": "ngcc"
31+
"analyze": "webpack-bundle-analyzer dist/stats.json"
3332
},
3433
"nodemonConfig": {
3534
"ext": "png,jpeg,js,ts,html,json,css,scss"
@@ -40,57 +39,57 @@
4039
},
4140
"private": true,
4241
"dependencies": {
43-
"@angular-devkit/build-angular": "14.2.10",
44-
"@angular/animations": "14.3.0",
45-
"@angular/cdk": "14.2.7",
46-
"@angular/cli": "14.2.10",
47-
"@angular/common": "14.3.0",
48-
"@angular/compiler": "14.3.0",
49-
"@angular/compiler-cli": "14.3.0",
50-
"@angular/core": "14.3.0",
51-
"@angular/forms": "14.3.0",
52-
"@angular/localize": "14.3.0",
42+
"@angular-devkit/build-angular": "16.2.14",
43+
"@angular/animations": "16.2.12",
44+
"@angular/cdk": "16.2.14",
45+
"@angular/cli": "16.2.14",
46+
"@angular/common": "16.2.12",
47+
"@angular/compiler": "16.2.12",
48+
"@angular/compiler-cli": "16.2.12",
49+
"@angular/core": "16.2.12",
50+
"@angular/forms": "16.2.12",
51+
"@angular/localize": "16.2.12",
5352
"@angular/material": "14.2.7",
5453
"@angular/material-moment-adapter": "14.2.7",
55-
"@angular/platform-browser": "14.3.0",
56-
"@angular/platform-browser-dynamic": "14.3.0",
57-
"@angular/router": "14.3.0",
54+
"@angular/platform-browser": "16.2.12",
55+
"@angular/platform-browser-dynamic": "16.2.12",
56+
"@angular/router": "16.2.12",
5857
"@derekbaker/ngx-ace-editor-wrapper": "12.2.16",
59-
"@ngx-translate/core": "14.0.0",
60-
"@ngx-translate/http-loader": "7.0.0",
61-
"@project-sunbird/chatbot-client": "4.0.0",
58+
"@ngx-translate/core": "15.0.0",
59+
"@ngx-translate/http-loader": "8.0.0",
60+
"@project-sunbird/chatbot-client": "8.0.1",
6261
"@project-sunbird/ckeditor-build-classic": "4.1.3",
6362
"@project-sunbird/client-services": "8.0.2",
64-
"@project-sunbird/common-consumption": "7.0.12",
65-
"@project-sunbird/common-form-elements-full": "6.0.3",
66-
"@project-sunbird/discussions-ui": "5.4.0",
63+
"@project-sunbird/common-consumption": "8.0.2-v16",
64+
"@project-sunbird/common-form-elements-full": "8.0.6",
65+
"@project-sunbird/discussions-ui": "8.0.3-v16",
6766
"@project-sunbird/ng2-semantic-ui": "8.0.2",
68-
"@project-sunbird/sb-content-section": "7.0.1",
69-
"@project-sunbird/sb-dashlet": "6.0.5",
70-
"@project-sunbird/sb-notification": "6.1.0",
67+
"@project-sunbird/sb-content-section": "8.0.2",
68+
"@project-sunbird/sb-dashlet": "8.0.2",
69+
"@project-sunbird/sb-notification": "8.0.1-v16.1",
7170
"@project-sunbird/sb-styles": "0.0.15",
72-
"@project-sunbird/sb-themes": "7.0.2",
71+
"@project-sunbird/sb-themes": "7.0.3-v16",
7372
"@project-sunbird/sunbird-collection-editor": "8.0.4",
7473
"@project-sunbird/sunbird-epub-player-v9": "5.6.0",
7574
"@project-sunbird/sunbird-epub-player-web-component": "1.4.1",
7675
"@project-sunbird/sunbird-file-upload-library": "1.0.4",
7776
"@project-sunbird/sunbird-pdf-player-v9": "5.5.0",
7877
"@project-sunbird/sunbird-pdf-player-web-component": "1.4.0",
7978
"@project-sunbird/sunbird-questionset-editor": "8.0.6",
80-
"@project-sunbird/sunbird-quml-player": "7.0.4",
79+
"@project-sunbird/sunbird-quml-player": "8.0.2",
8180
"@project-sunbird/sunbird-quml-player-v9": "5.1.5",
8281
"@project-sunbird/sunbird-quml-player-web-component": "4.0.2",
83-
"@project-sunbird/sunbird-resource-library": "7.0.4",
82+
"@project-sunbird/sunbird-resource-library": "8.0.2",
8483
"@project-sunbird/sunbird-video-player-v9": "5.5.1",
8584
"@project-sunbird/sunbird-video-player-web-component": "1.2.5",
8685
"@project-sunbird/telemetry-sdk": "0.0.29",
87-
"@project-sunbird/web-extensions": "6.0.0",
86+
"@project-sunbird/web-extensions": "8.0.1",
8887
"@samagra-x/uci-console": "6.0.3",
89-
"@shikshalokam/sl-questionnaire": "2.3.1",
90-
"@shikshalokam/sl-reports-library": "3.0.1",
88+
"@shikshalokam/sl-questionnaire": "7.0.0",
89+
"@shikshalokam/sl-reports-library": "6.0.0",
9190
"@swimlane/ngx-datatable": "20.1.0",
9291
"@types/jquery.fancytree": "2.7.34",
93-
"angular-datatables": "14.0.2",
92+
"angular-datatables": "16.0.0",
9493
"angular2-uuid": "1.1.1",
9594
"chart.js": "2.9.4",
9695
"common-form-elements-v9": "4.5.0",
@@ -128,8 +127,7 @@
128127
"md5": "2.2.1",
129128
"ng-recaptcha": "9.0.0",
130129
"ng2-cache-service": "1.1.1",
131-
"ng2-charts": "2.4.2",
132-
"ng2-semantic-ui-v9": "0.0.6",
130+
"ng2-charts": "5.0.4",
133131
"ngx-bootstrap": "8.0.0",
134132
"ngx-chips": "2.2.2",
135133
"ngx-daterangepicker-material": "6.0.4",
@@ -165,11 +163,13 @@
165163
"minimist": "1.2.5",
166164
"protractor": "7.0.0",
167165
"ts-node": "10.9.1",
168-
"typescript": "4.7.4",
166+
"typescript": "5.1.6",
169167
"typescript-eslint": "8.32.0",
170168
"webpack-bundle-analyzer": "4.7.0"
171169
},
172-
"resolutions": {},
170+
"resolutions": {
171+
"datatables.net": "1.10.20"
172+
},
173173
"jest": {
174174
"preset": "jest-preset-angular",
175175
"verbose": true,
@@ -220,6 +220,8 @@
220220
],
221221
"moduleNameMapper": {
222222
"canvas": "<rootDir>/__mocks__/canvas.js",
223+
"chart.js": "<rootDir>/__mocks__/chart.js",
224+
"ng2-charts": "<rootDir>/__mocks__/ng2-charts.js",
223225
"^@sunbird/core": "<rootDir>/src/app/modules/core",
224226
"^@sunbird/shared": "<rootDir>/src/app/modules/shared",
225227
"^@sunbird/home": "<rootDir>/src/app/modules/home",

src/app/client/src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
22
import { AppComponent } from './app.component';
33
import { AppRoutingModule } from './app.routing';
44
import { HttpClientModule, HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
5-
import { SuiModalModule } from 'ng2-semantic-ui-v9';
5+
import { SuiModalModule } from '@project-sunbird/ng2-semantic-ui';
66
import { CommonModule } from '@angular/common';
77
import { CoreModule, SessionExpiryInterceptor } from '@sunbird/core';
88
import { SharedModule } from '@sunbird/shared';

src/app/client/src/app/app.routing.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ const appRoutes: Routes = [
4444
{
4545
path: 'manage', loadChildren: () => import('./modules/manage/manage.module').then(m => m.ManageModule)
4646
},
47-
{
48-
path: 'uci-admin', loadChildren: () => import('./modules/uci-admin/uci-admin.module').then(m => m.UciAdminModule)
49-
},
5047
{
5148
path: '', loadChildren: () => import('./modules/public/public.module').then(m => m.PublicModule)
5249
},
@@ -83,7 +80,7 @@ const appRoutes: Routes = [
8380
];
8481

8582
@NgModule({
86-
imports: [RouterModule.forRoot(appRoutes, { relativeLinkResolution: 'corrected' })],
83+
imports: [RouterModule.forRoot(appRoutes)],
8784
exports: [RouterModule]
8885
})
8986
export class AppRoutingModule { }

src/app/client/src/app/modules/badging/badging.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
3-
import { SuiModule } from 'ng2-semantic-ui-v9';
3+
import { SuiModule } from '@project-sunbird/ng2-semantic-ui';
44
import { SharedModule } from '@sunbird/shared';
55
import { ContentBadgeComponent, AssignBadgesContentComponent } from './components';
66
import { ContentBadgeService } from './services';

src/app/client/src/app/modules/certificate/certificate.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SharedFeatureModule } from '@sunbird/shared-feature';
22
import { NgModule } from '@angular/core';
33
import { CommonModule } from '@angular/common';
44
import { CertificateRoutingModule } from './certificate-routing.module';
5-
import { SuiModalModule, SuiSelectModule, SuiDropdownModule, SuiPopupModule } from 'ng2-semantic-ui-v9';
5+
import { SuiModalModule, SuiSelectModule, SuiDropdownModule, SuiPopupModule } from '@project-sunbird/ng2-semantic-ui';
66
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
77
import { SharedModule } from '@sunbird/shared';
88
import { TelemetryModule } from '@sunbird/telemetry';

src/app/client/src/app/modules/certificate/components/browse-image-popup/browse-image-popup.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class FileReaderMock {
1010
DONE = FileReader.DONE;
1111
EMPTY = FileReader.EMPTY;
1212
LOADING = FileReader.LOADING;
13-
readyState = 0;
13+
readyState: 0 | 1 | 2 = 0;
1414
error: FileReader['error'] = null;
1515
result: FileReader['result'] = null;
1616
abort = jest.fn();

0 commit comments

Comments
 (0)