Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@
"options": {
"buildTarget": "testing-library:test-build-zoneless",
"setupFiles": ["projects/testing-library/test-setup.ts"],
"include": ["**/*.spec.ts", "../zoneless/**/*.spec.ts", "../schematics/**/*.spec.ts"]
"include": [
"**/*.spec.ts",
"../zone/**/*.spec.ts",
"../zoneless/**/*.spec.ts",
"../schematics/**/*.spec.ts"
]
}
},
"lint": {
Expand Down
5 changes: 4 additions & 1 deletion projects/testing-library/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"compilerOptions": {
"types": ["node"],
"target": "ES2022",
"useDefineForClassFields": false
"useDefineForClassFields": false,
"paths": {
"@testing-library/angular": ["./index.ts"]
}
},
"include": ["**/*.ts"]
}
1 change: 1 addition & 0 deletions projects/testing-library/zone/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/public_api';
1 change: 1 addition & 0 deletions projects/testing-library/zone/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions projects/testing-library/zone/src/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Public API Surface of @testing-library/angular/zone
*
* This entry point re-exports the zone-based API of `@testing-library/angular`.
* It exists so codebases can explicitly opt in to the zone-based `render`,
* ahead of `@testing-library/angular/zoneless` becoming the default.
*/

export * from '@testing-library/angular';
30 changes: 30 additions & 0 deletions projects/testing-library/zone/tests/zone.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Component } from '@angular/core';
import { test, expect } from 'vitest';
import * as root from '../../index';
import * as zone from '../index';
import { render, screen } from '../index';

test('re-exports the same public API as @testing-library/angular', () => {
const rootExports = root as Record<string, unknown>;
const zoneExports = zone as Record<string, unknown>;

expect(Object.keys(zoneExports).sort()).toEqual(Object.keys(rootExports).sort());

for (const key of Object.keys(rootExports)) {
expect(zoneExports[key]).toBe(rootExports[key]);
}
});

@Component({
selector: 'atl-fixture',
template: `<span>Hello {{ name }}</span>`,
})
class FixtureComponent {
name = 'world';
}

test('renders a component', async () => {
await render(FixtureComponent);

expect(screen.getByText('Hello world')).toBeInTheDocument();
});