Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 4 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular-builders/jest:run"
"builder": "@angular-builders/jest:run",
"options": {
"zoneless": false
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { provideZoneChangeDetection } from '@angular/core';
import { MATERIAL_ANIMATIONS } from '@angular/material/core';
import { MatDialogRef } from '@angular/material/dialog';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { render, screen } from '@testing-library/angular';
import userEvent from '@testing-library/user-event';

Expand All @@ -12,7 +12,7 @@ test('dialog closes', async () => {
const closeFn = jest.fn();
await render(DialogContentComponent, {
providers: [
provideNoopAnimations(),
{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } },
{
provide: MatDialogRef,
useValue: {
Expand All @@ -33,7 +33,7 @@ test('closes the dialog via the backdrop', async () => {
const user = userEvent.setup();

await render(DialogComponent, {
providers: [provideNoopAnimations()],
providers: [{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } }],
});

const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
Expand All @@ -57,7 +57,7 @@ test('opens and closes the dialog with buttons', async () => {
const user = userEvent.setup();

await render(DialogComponent, {
providers: [provideNoopAnimations(), provideZoneChangeDetection()],
providers: [{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } }, provideZoneChangeDetection()],
});

const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
Expand Down
4 changes: 2 additions & 2 deletions apps/example-app-karma/src/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
import JasmineDOM from '@testing-library/jasmine-dom';

// Install custom matchers from jasmine-dom
Expand All @@ -10,4 +10,4 @@ beforeEach(() => {
});

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {});
getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {});
8 changes: 4 additions & 4 deletions apps/example-app/src/app/examples/15-dialog.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MATERIAL_ANIMATIONS } from '@angular/material/core';
import { MatDialogRef } from '@angular/material/dialog';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { test, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/angular';
import userEvent from '@testing-library/user-event';
Expand All @@ -12,7 +12,7 @@ test('dialog closes', async () => {
const closeFn = vi.fn();
await render(DialogContentComponent, {
providers: [
provideNoopAnimations(),
{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } },
{
provide: MatDialogRef,
useValue: {
Expand All @@ -32,7 +32,7 @@ test('closes the dialog via the backdrop', async () => {
const user = userEvent.setup();

await render(DialogComponent, {
providers: [provideNoopAnimations()],
providers: [{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } }],
});

const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
Expand All @@ -56,7 +56,7 @@ test('opens and closes the dialog with buttons', async () => {
const user = userEvent.setup();

await render(DialogComponent, {
providers: [provideNoopAnimations()],
providers: [{ provide: MATERIAL_ANIMATIONS, useValue: { animationsDisabled: true } }],
});

const openDialogButton = await screen.findByRole('button', { name: /open dialog/i });
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@angular/core": "22.0.2",
"@angular/material": "22.0.0",
"@angular/platform-browser": "22.0.2",
"@angular/platform-browser-dynamic": "22.0.2",
"@angular/router": "22.0.2",
"@ngrx/store": "21.1.0",
"@testing-library/dom": "^10.4.1",
Expand All @@ -36,7 +35,7 @@
"zone.js": "^0.15.1"
},
"devDependencies": {
"@angular-builders/jest": "^20.0.0",
"@angular-builders/jest": "^22.0.1",
"@angular-devkit/core": "22.0.0",
"@angular-devkit/schematics": "22.0.0",
"@angular-eslint/builder": "22.0.0",
Expand Down Expand Up @@ -70,7 +69,8 @@
"jasmine-core": "4.2.0",
"jasmine-spec-reporter": "7.0.0",
"jest": "30.2.0",
"jest-preset-angular": "^16.0.0",
"jest-environment-jsdom": "30.2.0",
"jest-preset-angular": "^17.0.0",
"jsdom": "^27.3.0",
"karma": "6.4.0",
"karma-chrome-launcher": "^3.2.0",
Expand Down