Skip to content

Commit

Permalink
feat: upgrade to Angular 15
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Dec 4, 2023
1 parent 8973446 commit 56bbd68
Show file tree
Hide file tree
Showing 86 changed files with 7,383 additions and 13,725 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ testem.log
.DS_Store
Thumbs.db

migrations.json
apps/demo/routesFile.txt
.ssl
.angular
Expand Down
1 change: 0 additions & 1 deletion apps/demo/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export const appRoutes: Routes = [
imports: [
RouterModule.forRoot(appRoutes, {
initialNavigation: 'enabledBlocking',
relativeLinkResolution: 'corrected',
scrollPositionRestoration: `enabled`,
}),
],
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/app/pages/canvas/canvas-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class CanvasPageComponent {
dWidth = 100;
dHeight = 100;

globalCompositeOperation = 'source-over';
globalCompositeOperation: GlobalCompositeOperation = 'source-over';

mouth = 30;
blur = 0;
Expand Down
12 changes: 7 additions & 5 deletions libs/audio/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-coverage'),
],
files: [
{
Expand All @@ -31,10 +31,12 @@ module.exports = function (config) {
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/audio'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true,
preprocessors: {
'src/**/*.js': ['coverage'],
},
coverageReporter: {
type: 'html',
dir: require('path').join(__dirname, '../../coverage/payment-request'),
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand Down
6 changes: 5 additions & 1 deletion libs/audio/src/decorators/audio-param.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function audioParam<K extends string>(
): AudioParamDecorator<K> | AudioParamWorkletDecorator {
const decorator: AudioParamDecorator<K> = (target, propertyKey) => {
Object.defineProperty(target, propertyKey, {
configurable: true,
set(this: AudioNodeWithParams<K> | AudioWorkletNode, value: AudioParamInput) {
value = typeof value === 'string' ? Number.parseFloat(value) : value;

Expand All @@ -27,7 +28,10 @@ export function audioParam<K extends string>(
processAudioParam(audioParam, value, this.context.currentTime);
} else {
// Fallback for older browsers
Object.defineProperty(target, propertyKey, {value});
Object.defineProperty(target, propertyKey, {
value,
configurable: true,
});
}
},
});
Expand Down
15 changes: 2 additions & 13 deletions libs/audio/test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import './src/polyfill.js';
import 'zone.js';
import 'zone.js/testing';

import {getTestBed} from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);

// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

// And load the modules.
context.keys().map(context);
2 changes: 1 addition & 1 deletion libs/audio/tests/audio-buffer.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('AudioBufferService', () => {
});

beforeEach(() => {
service = TestBed.get(AudioBufferService);
service = TestBed.inject(AudioBufferService);
});

it('turns audio file to AudioBuffer', done => {
Expand Down
2 changes: 1 addition & 1 deletion libs/audio/tests/audio-worklet-processors-ready.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('AUDIO_WORKLET_PROCESSORS_READY', () => {
xit('rejects Promise if worklets are not supported', done => {
let rejected = false;

TestBed.get(AUDIO_WORKLET_PROCESSORS_READY).catch(() => {
TestBed.inject(AUDIO_WORKLET_PROCESSORS_READY).catch(() => {
rejected = true;
});

Expand Down
12 changes: 7 additions & 5 deletions libs/canvas/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-coverage'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/canvas'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true,
preprocessors: {
'src/**/*.js': ['coverage'],
},
coverageReporter: {
type: 'html',
dir: require('path').join(__dirname, '../../coverage/payment-request'),
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand Down
2 changes: 1 addition & 1 deletion libs/canvas/src/properties/compositing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class CompositingDirective implements CanvasMethod, CanvasCompositing {
globalAlpha = 1;

@Input()
globalCompositeOperation = 'source-over';
globalCompositeOperation: GlobalCompositeOperation = 'source-over';

call(context: CanvasRenderingContext2D) {
context.globalAlpha = this.globalAlpha;
Expand Down
3 changes: 3 additions & 0 deletions libs/canvas/src/properties/text-drawing-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export class TextDrawingStylesDirective implements CanvasMethod, CanvasTextDrawi
@Input()
textAlign: CanvasTextAlign = 'start';

@Input()
fontKerning: CanvasFontKerning = 'auto';

@Input()
textBaseline: CanvasTextBaseline = 'alphabetic';

Expand Down
14 changes: 2 additions & 12 deletions libs/canvas/test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import 'zone.js';
import 'zone.js/testing';

import {getTestBed} from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);

// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

// And load the modules.
context.keys().map(context);
2 changes: 1 addition & 1 deletion libs/canvas/tests/canvas-properties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import {CANVAS_PROPERTIES} from '../src/tokens/canvas-properties';

describe('CANVAS_PROPERTIES', () => {
it('is empty by default', () => {
expect(TestBed.get(CANVAS_PROPERTIES)).toEqual([]);
expect(TestBed.inject(CANVAS_PROPERTIES)).toEqual([]);
});
});
12 changes: 7 additions & 5 deletions libs/common/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-coverage'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/common'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true,
preprocessors: {
'src/**/*.js': ['coverage'],
},
coverageReporter: {
type: 'html',
dir: require('path').join(__dirname, '../../coverage/payment-request'),
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand Down
14 changes: 2 additions & 12 deletions libs/common/test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import 'zone.js';
import 'zone.js/testing';

import {getTestBed} from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);

// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

// And load the modules.
context.keys().map(context);
2 changes: 1 addition & 1 deletion libs/common/tests/animation-frame.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('ANIMATION_FRAME', () => {
TestBed.configureTestingModule({});

const animationFrame$: Observable<DOMHighResTimeStamp> =
TestBed.get(ANIMATION_FRAME);
TestBed.inject(ANIMATION_FRAME);

animationFrame$.pipe(first()).subscribe(timestamp => {
expect(typeof timestamp).toBe('number');
Expand Down
2 changes: 1 addition & 1 deletion libs/common/tests/caches.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('CACHES', () => {
it('injects window.caches object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(CACHES)).toBe(window.caches);
expect(TestBed.inject(CACHES)).toBe(window.caches);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('CRYPTO', () => {
it('injects window.crypto object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(CRYPTO)).toBe(window.crypto);
expect(TestBed.inject(CRYPTO)).toBe(window.crypto);
});
});
5 changes: 2 additions & 3 deletions libs/common/tests/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ describe('CSS', () => {
it('injects window.CSS object', () => {
TestBed.configureTestingModule({});

// @ts-ignore
expect(TestBed.get(CSS)).toBe(window.CSS);
expect(TestBed.inject(CSS)).toBe(window.CSS);
});

it('injects mock when CSS is not available', () => {
TestBed.configureTestingModule({
providers: [{provide: WINDOW, useValue: {}}],
});

const css = TestBed.get(CSS);
const css = TestBed.inject(CSS);

expect(css.supports('display', 'block')).toBe(false);
expect(css.escape('<&>hapica$')).toBe('<&>hapica$');
Expand Down
2 changes: 1 addition & 1 deletion libs/common/tests/history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('HISTORY', () => {
it('injects window.history object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(HISTORY)).toBe(window.history);
expect(TestBed.inject(HISTORY)).toBe(window.history);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/local-storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('LOCAL_STORAGE', () => {
it('injects window.localStorage object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(LOCAL_STORAGE)).toBe(window.localStorage);
expect(TestBed.inject(LOCAL_STORAGE)).toBe(window.localStorage);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('LOCATION', () => {
it('injects window.location object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(LOCATION)).toBe(window.location);
expect(TestBed.inject(LOCATION)).toBe(window.location);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/media-devices.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('MEDIA_DEVICES', () => {
it('injects window.navigator object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(MEDIA_DEVICES)).toBe(window.navigator.mediaDevices);
expect(TestBed.inject(MEDIA_DEVICES)).toBe(window.navigator.mediaDevices);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/navigator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('WINDOW', () => {
it('injects window.navigator object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(NAVIGATOR)).toBe(window.navigator);
expect(TestBed.inject(NAVIGATOR)).toBe(window.navigator);
});
});
4 changes: 2 additions & 2 deletions libs/common/tests/network-information.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('NETWORK_INFORMATION', () => {
it('injects window.navigator.connection object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(NETWORK_INFORMATION)).toBe(
expect(TestBed.inject(NETWORK_INFORMATION)).toBe(
(window.navigator as any).connection,
);
});
Expand All @@ -17,6 +17,6 @@ describe('NETWORK_INFORMATION', () => {
providers: [{provide: NAVIGATOR, useValue: {}}],
});

expect(TestBed.get(NETWORK_INFORMATION)).toBe(null);
expect(TestBed.inject(NETWORK_INFORMATION)).toBe(null);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/page-visibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('PAGE_VISIBILITY', () => {
it('watching for page visibility state', done => {
TestBed.configureTestingModule({});

const pageVisibility$: Observable<boolean> = TestBed.get(PAGE_VISIBILITY);
const pageVisibility$: Observable<boolean> = TestBed.inject(PAGE_VISIBILITY);

pageVisibility$.pipe(first()).subscribe(state => {
expect(typeof state).toBe('boolean');
Expand Down
2 changes: 1 addition & 1 deletion libs/common/tests/performance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('PERFORMANCE', () => {
it('injects window.performance object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(PERFORMANCE)).toBe(window.performance);
expect(TestBed.inject(PERFORMANCE)).toBe(window.performance);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/screen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('SCREEN', () => {
it('injects window.screen object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(SCREEN)).toBe(window.screen);
expect(TestBed.inject(SCREEN)).toBe(window.screen);
});
});
2 changes: 1 addition & 1 deletion libs/common/tests/session-storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ describe('SESSION_STORAGE', () => {
it('injects window.sessionStorage object', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(SESSION_STORAGE)).toBe(window.sessionStorage);
expect(TestBed.inject(SESSION_STORAGE)).toBe(window.sessionStorage);
});
});
4 changes: 2 additions & 2 deletions libs/common/tests/speech-recognition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('SPEECH_RECOGNITION', () => {
it('injects webkitSpeechRecognition class', () => {
TestBed.configureTestingModule({});

expect(TestBed.get(SPEECH_RECOGNITION)).toBe(
expect(TestBed.inject(SPEECH_RECOGNITION)).toBe(
(window as any).webkitSpeechRecognition,
);
});
Expand All @@ -18,7 +18,7 @@ describe('SPEECH_RECOGNITION', () => {

(window as any).webkitSpeechRecognition = undefined;

expect(TestBed.get(SPEECH_RECOGNITION)).toBeNull();
expect(TestBed.inject(SPEECH_RECOGNITION)).toBeNull();

(window as any).webkitSpeechRecognition = speechRecognition;
});
Expand Down
Loading

0 comments on commit 56bbd68

Please sign in to comment.