Skip to content

Commit

Permalink
fix(A19): Forgot to flush TestBed
Browse files Browse the repository at this point in the history
Added standalone false as default for mock-render and updated isStandalone method to handle angular 19+ default standalone behavior for components.
  • Loading branch information
re-alam committed Nov 28, 2024
1 parent 30857bb commit 40ee673
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions libs/ng-mocks/src/lib/common/func.is-standalone.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Component, VERSION } from '@angular/core';

import { isStandalone } from './func.is-standalone';

@Component({
selector: 'standalone',
template: `<div>
<h1>Angular 19 standalone</h1>
</div>`,
})
class StandaloneComponent {}

describe('func.is-standalone', () => {
describe('Angular Angular 19+ specific tests', () => {
let originalVersion: { major: string };
const setVersionMajor = (major: number) => {
Object.assign(VERSION, { major: major.toString() });
};

beforeAll(() => {
originalVersion = { ...VERSION };
});

afterEach(() => {
Object.assign(VERSION, originalVersion);
});

it('should return true when standalone is undefined', () => {
setVersionMajor(19);
expect(isStandalone(StandaloneComponent)).toBeTruthy();
});
});
});

0 comments on commit 40ee673

Please sign in to comment.