mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
With Node.js v18 approaching End-of-Life on 2025-04-30, the minimum supported versions for development have been updated to `^20.11.1 || ^22.11.0`. This change does not affect published packages. The custom ESM loader was disabled in several Node.js jasmine tests due to incompatibilities with the updated custom loader API in newer Node.js versions. The API in v18 was not considered stable. The rules_js migration will remove the need for this loader fully in future. PR Close #60080
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
import domino from '../src/bundled-domino';
|
|
import {applyShims} from '../src/shims';
|
|
|
|
describe('applyShims()', () => {
|
|
const globalClone = {...global};
|
|
|
|
afterEach(() => {
|
|
// Un-patch `global`.
|
|
const currentProps = Object.keys(global);
|
|
for (const prop of currentProps) {
|
|
if (prop === 'crypto') {
|
|
// crypto is a getter and cannot be changed
|
|
continue;
|
|
}
|
|
if (globalClone.hasOwnProperty(prop)) {
|
|
(global as any)[prop] = (globalClone as any)[prop];
|
|
} else {
|
|
delete (global as any)[prop];
|
|
}
|
|
}
|
|
});
|
|
|
|
it('should load `domino.impl` onto `global`', () => {
|
|
expect(global).not.toEqual(jasmine.objectContaining(domino.impl));
|
|
|
|
applyShims();
|
|
expect(global).toEqual(jasmine.objectContaining(domino.impl));
|
|
});
|
|
|
|
it('should define `KeyboardEvent` on `global`', () => {
|
|
expect((global as any).KeyboardEvent).not.toBe((domino.impl as any).Event);
|
|
|
|
applyShims();
|
|
expect((global as any).KeyboardEvent).toBe((domino.impl as any).Event);
|
|
});
|
|
});
|